Can't See My COM Server in COM Browser

Jeff Miller johoffry at yahoo.com
Wed Jan 22 17:59:33 EST 2003


Hi all,
I am really new to COM and I am using ActivePython to create a COM
server. I want to be able to see the server with the COM browser. What
do I need to do it. For now it would suffice just to see the
HelloWorld example in the COM browser. Here is the code
class HelloWorld:
    _reg_clsid_ = "{D036ADC2-005F-4461-B48C-C946D557B406}"
    _reg_desc_ = "Python Test COM Server"
    _reg_progid_ = "Python.TestServer"
    _public_methods_ = [ 'Hello' ]
    _public_attrs_ = [ 'softspace', 'noCalls' ]
    _readonly_attrs_ = [ 'noCalls' ]

    def __init__( self ):
        self.softspace = 1
        self.noCalls = 0
    def Hello( self, who ):
        self.noCalls += 1
        # insert "softspace" number of spaces
        return "Hello" + " " * self.softspace + str( who )


if __name__ == '__main__':
    import win32com.server.register
    win32com.server.register.UseCommandLine( HelloWorld )

I can use the server through a python client like such:
import win32com.client
o = win32com.client.Dispatch( "Python.TestServer" )
o._print_details_()
o.softspace = 10
print o.Hello( "Jeff" )

But I cannot see the "Python.TestSever" in the list that COM browser
displays. Don't ask why I want to do this unless you want a long
explanation.
Thanks for any help - JeffM




More information about the Python-list mailing list