[python-win32] Problem on com server ony in a specifie application

Matteo Boscolo matteo.boscolo at boscolini.eu
Thu Jan 6 10:13:13 CET 2011


Hi List,
this is my first post ..
I can't find a solution at this little scripts.

if you run the test.vbs the scripts work very well ..
but if I try to get it work under a thinkdesign (A cad package) I got an 
error in the test.comInit method ..
this is the error that the cad give to me :
    Automation error 0x4005
any idea on how to survive from this error ?
any help suggestion will be very helpful

Regards,
Matteo

#test.py
from test1 import test1

class test(object):
     """
         The main client application
     """
     _reg_clsid_ =   "{F92FB064-0B23-4AE7-BE1A-79DD8B820100}"
     _reg_desc_ =    "test module"
     _reg_progid_ =  "test.application"
     _public_methods_ = ['comInit','Now','GetIstance']
     def __init__(self):
         self._test1=None
     def comInit(self,ob):
             self._obj=test1(obj)
     def Now(self,msg):
         return"Now" +str(msg)
     def GetIstance(self):
         return str(self._obj.getArg())

#Thinkdesing command line sequence
#o:=newObj('test.application')
#o->Now("ciao")
#o->comInit("aa")

if __name__=='__main__':
     import win32com.server.register
     win32com.server.register.UseCommandLine(test)
     t=test()
     t.Now("now  ")
     t.comInit("aa")
     print t.GetIstance()

#test1.py
class test1:
     def __init__(self,arg=None):
         self._arg=arg
     def getArg(self):
         return "done "+str(self._arg)

'test.vbs
dim o
set o=createObject("test.application")
msgbox o.now(" ciao")
o.comInit("aaa")
msgbox o.GetIstance


More information about the python-win32 mailing list