Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 262533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T22:31:25+00:00 2026-05-11T22:31:25+00:00

I wanted to implement python com server using win32com extensions. Then consume the server

  • 0

I wanted to implement python com server using win32com extensions.
Then consume the server from within the .NET.
I used the following example to implement the com server and it runs without a problem but when I try to consume it using C# I got FileNotFoundException with the following message “Retrieving the COM class factory for component with CLSID {676E38A6-7FA7-4BFF-9179-AE959734DEBB} failed due to the following error: 8007007e.” . I posted the C# code as well.I wonder if I’m missing something I would appreciate any help.

Thanks,
Sarah

#PythonCOMServer.py

import pythoncom
class PythonUtilities:
    _public_methods_ = [ 'SplitString' ]
    _reg_progid_ = "PythonDemos.Utilities"
    # NEVER copy the following ID

    # Use"print pythoncom.CreateGuid()" to make a new one.
    _reg_clsid_ = pythoncom.CreateGuid()
    print _reg_clsid_
    def SplitString(self, val, item=None):
        import string
        if item != None: item = str(item)
        return string.split(str(val), item)

# Add code so that when this script is run by
# Python.exe,.it self-registers.

if __name__=='__main__':        
    print 'Registering Com Server'
    import win32com.server.register
    win32com.server.register.UseCommandLine(PythonUtilities)


// the C# code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {

              Type pythonServer;
              object pythonObject;
              pythonServer = Type.GetTypeFromProgID("PythonDemos.Utilities");
              pythonObject = Activator.CreateInstance(pythonServer);

        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T22:31:25+00:00Added an answer on May 11, 2026 at 10:31 pm

    A COM server is just a piece of software (a DLL or an executable) that will accept remote procedure calls (RPC) through a defined protocol. Part of the protocol says that the server must have a unique ID, stored in the Windows’ registry.
    In our case, this means that you have "registered" a server that is not existing. Thus the error (component not found).

    So, it should be something like this (as usual, this is untested code!):

    import pythoncom
    
    class HelloWorld:
        _reg_clsctx_ = pythoncom.CLSCTX_LOCAL_SERVER
        _reg_clsid_ = "{B83DD222-7750-413D-A9AD-01B37021B24B}"
        _reg_desc_ = "Python Test COM Server"
        _reg_progid_ = "Python.TestServer"
        _public_methods_ = ['Hello']
        _public_attrs_ = ['softspace', 'noCalls']
        _readonly_attrs_ = ['noCalls']
        # for Python 3.7+
        _reg_verprogid_ = "Python.TestServer.1"
        _reg_class_spec_ = "HelloWorldCOM.HelloWorld"
    
        def __init__(self):
            self.softspace = 1
            self.noCalls = 0
    
        def Hello(self, who):
            self.noCalls = self.noCalls + 1
            # insert "softspace" number of spaces
            return "Hello" + " " * self.softspace + str(who)
    
    if __name__ == '__main__':
        if '--register' in sys.argv[1:] or '--unregister' in sys.argv[1:]:
            import win32com.server.register
            win32com.server.register.UseCommandLine(HelloWorld)
        else:
            # start the server.
            from win32com.server import localserver
            localserver.serve(['{B83DD222-7750-413D-A9AD-01B37021B24B}'])
    
    

    Then you should run from the command line (assuming the script is called HelloWorldCOM.py):

    HelloWorldCOM.py --register
    HelloWorldCOM.py
    

    Class HelloWorld is the actual implementation of the server. It expose one method (Hello) and a couple of attributes, one of the two is read-only.
    With the first command, you register the server; with the second one, you run it and then it becomes available to usage from other applications.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 157k
  • Answers 157k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You can use numeric entities in XML to help with… May 12, 2026 at 11:09 am
  • Editorial Team
    Editorial Team added an answer Rob's solution will work (+1), but if you don't need… May 12, 2026 at 11:09 am
  • Editorial Team
    Editorial Team added an answer If you can modify your vm:TabViewModel I should change your… May 12, 2026 at 11:09 am

Related Questions

I'm building a game server in Python and I just wanted to get some
As a self-taught python hobbyist, how would I go about learning to import and
What is the recommended location to save user preference files? Is there a recommended
Erlang is getting a reputation for being untouchable at handling a large volume of

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.