[python-win32] Launching COM apps from Python
Tony Cappellini
tony at tcapp.com
Fri May 7 20:15:24 EDT 2004
I'm trying to launch an in-house COM-server from Python.
I do have the IDL file that the TLB was created from but ....
I haven't been to launch the program successfully yet.
I've registered the app as a com server, run makepy and imported the
resulting py file.
I've tried following the examples in Programming Python on W32 as well.
So I looked in the Win32com/test directory, at the test scripts for the
Office Apps, trying to follow suit.
I've tried this approach
mytest = win32com.client.dynamic.Dispatch("mytest.Application")
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
File "C:\Python23\Lib\site-packages\win32com\client\__init__.py", line
95, in Dispatch
dispatch, userName =
dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
File "C:\Python23\Lib\site-packages\win32com\client\dynamic.py", line
91, in _GetGoodDispatchAndUserName
return (_GetGoodDispatch(IDispatch, clsctx), userName)
File "C:\Python23\Lib\site-packages\win32com\client\dynamic.py", line
79, in _GetGoodDispatch
IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx,
pythoncom.IID_IDispatch)
com_error: (-2147221005, 'Invalid class string', None, None)
as well as
mytest = win32com.client.dynamic.Dispatch("mytest")
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
File "C:\Python23\Lib\site-packages\win32com\client\__init__.py", line
95, in Dispatch
dispatch, userName =
dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
File "C:\Python23\Lib\site-packages\win32com\client\dynamic.py", line
91, in _GetGoodDispatchAndUserName
return (_GetGoodDispatch(IDispatch, clsctx), userName)
File "C:\Python23\Lib\site-packages\win32com\client\dynamic.py", line
79, in _GetGoodDispatch
IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx,
pythoncom.IID_IDispatch)
com_error: (-2147221005, 'Invalid class string', None, None)
I've substituted the name "mytest" with the case-sensitive name from the
IDL file.
This COM stuff just drives me crazy.
Would anyone mind pointing me in the right direction?
thanks
More information about the Python-win32
mailing list