Bug in COM Makepy utility? (ActivePython 2.4)

Steve M sjmaster at gmail.com
Fri Oct 7 00:08:07 CEST 2005

When I use the COM Makepy utility on one computer with WindowsXP,
ActivePython 2.3 and I select the library Microsoft Word 10.0 Object
Library (8.2), things work fine.
When I have WindowsXP, ActivePython 2.4 (build 247) and Microsoft Word
11.0 Object Library (8.3), then I get the following SyntaxError, and on
two different computers I tested this. More on the error below, but has
anyone else had this problem? Will there soon be a newer build of
ActivePython? I've never used the standard Python distribution with
manually installed win32all package, just because its so easy to deploy
ActivePython. Should I consider switching, now that I'm on the topic?

>>> Generating to C:\Python24\lib\site-packages\win32com\gen_py\00020905-0000-0000-C000-000000000046x0x8x3\__init__.py
Building definitions from type library...
Importing module
Failed to execute command:
from win32com.client import makepy;makepy.main()
Traceback (most recent call last):
line 103, in HandleToolCommand
    exec "%s\n" % pyCmd
  File "<string>", line 1, in ?
  File "C:\Python24\lib\site-packages\win32com\client\makepy.py", line
363, in main
    GenerateFromTypeLibSpec(arg, f, verboseLevel = verboseLevel,
bForDemand = bForDemand, bBuildHidden = hiddenSpec)
  File "C:\Python24\lib\site-packages\win32com\client\makepy.py", line
274, in GenerateFromTypeLibSpec
    gencache.AddModuleToCache(info.clsid, info.lcid, info.major,
  File "C:\Python24\Lib\site-packages\win32com\client\gencache.py",
line 555, in AddModuleToCache
    mod = _GetModule(fname)
  File "C:\Python24\Lib\site-packages\win32com\client\gencache.py",
line 634, in _GetModule
    mod = __import__(mod_name)
line 2831
     '{00020960-0000-0000-C000-000000000046}' : 'Pane',
	'{00020961-0000-0000-C000-000000000046}' : 'Windows',
 SyntaxError: invalid syntax

I don't entirely understand the error (I'm rather ignorant of the whole
process Makepy is doing, come to think of it...). First of all, when I
load the file with the alleged syntax error into Scite, the line where
the caret is pointing to is actually 2838, not line 2831. Further, I
cannot detect any syntax errors based on visual inspection. In fact,
when I copy/paste lines 2830-2840 into a new script and put "d = {"
before the lines and "}" after the lines, it is syntactically valid
python that executes without complaint. I don't know how "dynamically"
this file is being generated, but somethin' ain't right.

More information about the Python-list mailing list