Need Help building COM server in python

michiel michiel at htcs.nl
Thu Jun 14 05:16:08 EDT 2001


Hi,

First of all, I'm a newbie, so my question may be simple.

I have tried to make a simple COM object in python for the use in VB
or Visual FoxPro. Therefore I have used the tutorial for building a
COM server object in python.

CODE CLASS:

class HelloWorld:
    _reg_clsid_  = "{D4FF29AD-BCDE-4FE2-9896-892D2EBB5180}"
    _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 = self.noCalls + 1
    return "Hello" + " " * self.softspace + str(who)

if __name__=='__main__':
    import win32com.server.register 
    print "Registering COM server..."
    win32com.server.register.UseCommandLine(HelloWorld)

MY COMPUTER:

PIII 550
400 meg internal
Win 2000 Server
Active python 2.1 installed
I have admin rights

PROBLEM:

Registration of the object works.
Creation of the object works (x=createobject("python.object")),
but then there are no methodes I can access: "there is no such method"

Can someone help me out or send me an example of a useable COM server
object written in python?

Thanks.



More information about the Python-list mailing list