frozen win32com problem

Gordon McMillan gmcm at hypernet.com
Thu Jan 3 15:05:08 EST 2002


Robin Becker wrote:

> I am attempting to implement a frozen python win32com object.
> We are using a variant of Gordon McMillan's 4.x installer framework
> to create a python.exe which works fine. Most .pycs are in a .pyz file,
> but the win32/lib files and win32com/server+client files are in
> the real file system. 
> 
> I have only got pythoncom21.dll, pywintypes21.dll, win32api.pyd and
> win32trace.pyd on the target system.
> 
> I find that I can use my objects if I manually register them to use my
> localserver only. So I have a working setup except for registration on
> the target machine.

localserver only applies if you're using LOCAL_SERVER.
 
> When I try to use the standard command line registration/unregistration
> mechanism I'm getting an error from
> win32com.server.register._cat_registrar 
> 
> eg with the cut down file \tmp\dingo.py
> 
> import pythoncom
> def _cat_registrar():
>   return pythoncom.CoCreateInstance(
>     pythoncom.CLSID_StdComponentCategoriesMgr,
>     None,
>     pythoncom.CLSCTX_INPROC_SERVER,
>     pythoncom.IID_ICatRegister
>     )
> 
> print 'CLSID_StdComponentCategoriesMgr',
> pythoncom.CLSID_StdComponentCategoriesMgr print 'CLSCTX_INPROC_SERVER',
> pythoncom.CLSCTX_INPROC_SERVER print 'IID_ICatRegister',
> pythoncom.IID_ICatRegister print _cat_registrar()
> 
> 
> C:\ReportLab>\tmp\dingo.py
> CLSID_StdComponentCategoriesMgr
> <iid:{0002E005-0000-0000-C000-000000000046}
> CLSCTX_INPROC_SERVER 1
> IID_ICatRegister <iid:{0002E012-0000-0000-C000-000000000046}>
> Traceback (most recent call last):
>   File "C:\tmp\dingo.py", line 13, in ?
>     print _cat_registrar()
>   File "C:\tmp\dingo.py", line 7, in _cat_registrar
>     pythoncom.IID_ICatRegister
> pywintypes.com_error: (-2147221164, 'Class not registered', None, None)
> 
> 
> this is on an NT4 system that has no python/pythonwin etc. Any ideas
> what I'm missing/haven't registered?

You seem to be asking for INPROC_SERVER. That means COM loads 
pythoncomXX.dll which (implicitly) loads pythonXX.dll. There's no chance for 
the import hooks to get installed.

Unless you upgrade to release 5.

-- Gordon
http://www.mcmillan-inc.com/




More information about the Python-list mailing list