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

Mark Hammond mhammond at skippinet.com.au
Fri Sep 6 21:54:09 EDT 2002


Thomas Jensen wrote:

> 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)
> 

Are you sure that the COM object you are using is correctly registered 
for use as a DCOM server.  The code above insists that the COM object be 
registered as LocalServer - ie, other than just InprocServer32.

Can you reproduce the registry entries for this COM server (the ones 
under HKCR\CLSID\the-long-guid-for-the-object )

Regards,

Mark.





More information about the Python-list mailing list