COM with Python.
Ken Guest
kwg at renre-europe.com
Fri Dec 7 11:18:51 EST 2001
I'm new to coding com objects in Python and am trying to figure out why
I keep getting a Run Time error 429 (ActiveX component can't create
Object) raised by VB's CreateObject function.
Everything seems to register ok (as far as registering as a COM server
anyways). But I keep getting either that error, or python import related
errors.
I've tried using SimpleCOMServer.py from chapter 5 of the "Programming
on Win32" book and attempting to create a PythonUtilities object and
that worked fine.
could somebody please help me on this one? thanks.
k.
===vb code===
Dim svr As Object
Set svr = VBA.CreateObject("renre.GPS_layerstats.Objects.COMRunObject")
===python code below====
---Objects.py-----
class RunObject:
def __init__(self):
self._results = None
def test(self):
return "test"
class COMRunObject(RunObject):
"""COM version of the RunObject."""
_reg_clsid_ = '{358FD80E-1190-40A7-9796-D5DBDB52f580}'
_reg_desc_ = "renre.GPS_layerstats.Objects"
_reg_progid_ = "renre.GPS_layerstats.Objects"
_reg_class_spec_= "renre.GPS_layerstats.Objects.COMRunObject"
_public_methods_ = ["test"
]
def __init__(self):
self._robj = RunObject()
self.userNameSpace = {'RunObject':self._robj}
----app.py----
import Objects
if __name__ == __main__:
if os_name == "nt":
import win32com.server.register
win32com.server.register.UseCommandLine(Objects.COMRunObject)
--
The duck quacks.
More information about the Python-list
mailing list