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

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


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 which contain the lines:
   clsctx = pythoncom.CLSCTX_SERVER & ~pythoncom.CLSCTX_INPROC_SERVER
   ob = win32com.client.DispatchEx("Python.Interpreter", serverName, 

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

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 "", line 30, in ?
   File "", line 15, in test
     batch = win32com.client.DispatchEx("IGBatchNGBackend.IGBatch", 
"C:\PROGRA~1\PYTHON22\lib\site-packages\win32com\client\", lin
e 109, in DispatchEx
     dispatch = pythoncom.CoCreateInstanceEx(clsid, None, clsctx, 
serverInfo, (py
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