Using Python to call a DCOM server - "'Class not registered"

Thomas Jensen spam at ob_scure.dk
Fri Sep 6 06:04:05 EDT 2002


Hi,

I'm sorry if this post is somewhat OT, please direct me to the correct 
group if it is.

I'm having some trouble using win32all to call a DCOM server.

win32all includes a file called testDCOM.py which contain the lines:
   clsctx = pythoncom.CLSCTX_SERVER & ~pythoncom.CLSCTX_INPROC_SERVER
   ob = win32com.client.DispatchEx("Python.Interpreter", serverName, 
clsctx=clsctx)

substituting serverName with "localhost" works fine and I get the 
extepcted "error":
   Error: The object created on server 'localhost' reported its name as 
'MJOELNER'

However when I substitute "Python.Interpreter" with my own component, I 
get a "Class not registered" error.

Code that works:
   batch = win32com.client.Dispatch("IGBatchNGBackend.IGBatch")

Code that doesn't work:
   clsctx = pythoncom.CLSCTX_SERVER & ~pythoncom.CLSCTX_INPROC_SERVER
   batch = win32com.client.DispatchEx("IGBatchNGBackend.IGBatch", 
'localhost', clsctx=clsctx)

The traceback is:

Traceback (most recent call last):
   File "test01.py", line 30, in ?
     test()
   File "test01.py", line 15, in test
     batch = win32com.client.DispatchEx("IGBatchNGBackend.IGBatch", 
'localhost',
clsctx=clsctx)
   File 
"C:\PROGRA~1\PYTHON22\lib\site-packages\win32com\client\__init__.py", lin
e 109, in DispatchEx
     dispatch = pythoncom.CoCreateInstanceEx(clsid, None, clsctx, 
serverInfo, (py
thoncom.IID_IDispatch,))[0]
pywintypes.com_error: (-2147221164, 'Class not registered', None, None)


Thanks in advance

-- 
Best Regards
Thomas Jensen
(remove underscore in email address to mail me)




More information about the Python-list mailing list