<div dir="ltr"><p>Hi all,</p>

I implemented a python com server and generate an executable and dll
using py2exe tool.
then I used regsvr32.exe to register the dll.I got a message that the
registration was successful. Then I tried to add reference to that dll
in .NET. But I can not find my server on the com tab of adding a reference. I want to mention that I can run the server as a python script and consume it from .net using late binding.
Is there something I&#39;m missing or doing wrong? I would appreciate any help.<br><br>#hello.py<br><br>import pythoncom<br>import sys<br><br><br>class HelloWorld:<br>    #pythoncom.frozen = 1<br>    if hasattr(sys, &#39;importers&#39;):<br>
        _reg_class_spec_ = &quot;__main__.HelloWorld&quot; <br>    _reg_clsctx_ = pythoncom.CLSCTX_LOCAL_SERVER<br>    _reg_clsid_ = &#39;{CDBA816B-E80F-4545-BB68-5A3270C92A74}&#39;<br>    _reg_desc_ = &quot;Python Test COM Server&quot;<br>
    _reg_progid_ = &quot;Python.TestServer&quot;<br>    _public_methods_ = [&#39;Hello&#39;]<br>    _public_attrs_ = [&#39;softspace&#39;, &#39;noCalls&#39;]<br>    _readonly_attrs_ = [&#39;noCalls&#39;]<br>    <br>    def __init__(self):<br>
        self.softspace = 1<br>        self.noCalls = 0<br><br>    def Hello(self, who):<br>        self.noCalls = self.noCalls + 1<br>        # insert &quot;softspace&quot; number of spaces<br>        print &quot;Hello&quot; + &quot; &quot; * self.softspace + str(who)<br>
        return &quot;Hello&quot; + &quot; &quot; * self.softspace + str(who)<br><br>if __name__==&#39;__main__&#39;:<br>    import sys<br>    if hasattr(sys, &#39;importers&#39;):<br>        # running as packed executable.<br>
        if &#39;--register&#39; in sys.argv[1:] or &#39;--unregister&#39; in sys.argv[1:]:<br>            # --register and --unregister work as usual<br>            import win32com.server.register<br>            win32com.server.register.UseCommandLine(HelloWorld)<br>
        else:<br>            # start the server.<br>            from win32com.server import localserver<br>            localserver.serve(&#39;CDBA816B-E80F-4545-BB68-5A3270C92A74&#39;)<br>    else:<br>        import win32com.server.register<br>
        win32com.server.register.UseCommandLine(HelloWorld) <br><br># setup.py<br>from distutils.core import setup<br>import py2exe<br>setup(com_server = [&quot;hello&quot;])<br><br clear="all">Thanks<br>-- <br>Sarah Abdelrazak<br>

</div>