[python-win32] com server

Floris van Nee floris.vannee at gmail.com
Fri Apr 7 19:34:49 CEST 2006


Hi,

Is it possible to create a com server in python and then access that
server using VB .NET, for example using the following code. A very
basic com server i found in a tutorial about win32com:

class HelloWorld:
    _reg_clsid_ = "{7CC9F362-486D-11D1-BB48-0000E838A65F}"

    _reg_desc_ = "Python Test COM Server"

    _reg_progid_ = "Python.TestServer"

    # Next line assumes file is "testcomserver.py"

    _reg_class_spec_ = "testcomserver.HelloWorld"

    _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 = self.noCalls + 1

        # insert "softspace" number of spaces

        return "Hello" + " " * self.softspace + who

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

When I run it it says: '>>>  Registered: Python.TestServer '

But how can I access that server now from VB .NET (if it's possible).
Or do I need to use very different python code?

Thanks in advance,

Floris van Nee
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20060407/d5632457/attachment.htm 


More information about the Python-win32 mailing list