[python-win32] Problem with gencache.EnsureModule

Johannes Brunen jbrunen at datasolid.de
Mon Jun 6 17:19:11 CEST 2005


Hi,

First, I'm new to this list as well as new to python/pythonCom.
I have tried to connect to a COM server installed on my machine
with this little script:

import win32com.client

from win32com.client import gencache

def main():
    gencache.EnsureModule('{9C3BB401-114D-11D4-AC72-00105A4925FC}', 0, 1, 2)
    gencache.EnsureModule('{F6B548E2-1A91-11D4-AC7B-00105A4925FC}', 0, 1, 2)
    gencache.EnsureModule('{2FF5212B-C12E-11D4-AD46-00105A4925FC}', 0, 1, 2)
    gencache.EnsureModule('{9C3BB403-114D-11D4-AC72-00105A4925FC}', 0, 1, 2)
    gencache.EnsureModule('{D5224AA1-0F95-11D4-AC6E-00105A4925FC}', 0, 1, 2)
    gencache.EnsureModule('{83273D63-C3B6-11D6-99B4-00105A492792}', 0, 1, 2)
    gencache.EnsureModule('{DA061171-5185-11D4-8B25-00105A49278B}', 0, 1, 2)

    theCADdy = win32com.client.Dispatch("CADdy.CADdy")

if __name__ == '__main__':
    main()

I have used makepy.py -i to get the guids of the registered type libraries. Running
this script yields

[C:/Development/Learn/Python/COM] Test2.py
Traceback (most recent call last):
  File "C:\DEVELO~1\Learn\Python\COM\test2.py", line 19, in ?
    main()
  File "C:\DEVELO~1\Learn\Python\COM\test2.py", line 9, in main
    gencache.EnsureModule('{9C3BB401-114D-11D4-AC72-00105A4925FC}', 0, 1, 2)
  File "C:\Programme\Python\Lib\site-packages\win32com\client\gencache.py", line 525, in EnsureModule
    module = MakeModuleForTypelib(typelibCLSID, lcid, major, minor, progressInstance, bForDemand = bForDemand, bBuildHid
den = bBuildHidden)
  File "C:\Programme\Python\Lib\site-packages\win32com\client\gencache.py", line 292, in MakeModuleForTypelib
    makepy.GenerateFromTypeLibSpec( (typelibCLSID, lcid, major, minor), progressInstance=progressInstance, bForDemand =
bForDemand, bBuildHidden = bBuildHidden)
  File "c:\programme\python\lib\site-packages\win32com\client\makepy.py", line 274, in GenerateFromTypeLibSpec
    gencache.AddModuleToCache(info.clsid, info.lcid, info.major, info.minor)
  File "C:\Programme\Python\Lib\site-packages\win32com\client\gencache.py", line 555, in AddModuleToCache
    mod = _GetModule(fname)
  File "C:\Programme\Python\Lib\site-packages\win32com\client\gencache.py", line 634, in _GetModule
    mod = __import__(mod_name)
  File "C:\DOKUME~1\Arthur\LOKALE~1\Temp\gen_py\2.4\9C3BB401-114D-11D4-AC72-00105A4925FCx0x1x2\__init__.py", line 57
        'IEnumCADdyAddIn' : '{14F65AE3-4671-11D4-8B1A-00105A49278B}',
                                                                                                          ^
SyntaxError: invalid syntax

Can anyone tell me what I'm doing wrong. Is this a known problem?
I'm using the ActiveState Python 2.4.1.-245 build.

With  kind regards

Johannes




____________
Virus checked by G DATA AntiVirusKit


More information about the Python-win32 mailing list