467,143 Members | 1,232 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,143 developers. It's quick & easy.

Bug in COM Makepy utility? (ActivePython 2.4)

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.

Oct 6 '05 #1
  • viewed: 2420
1 Reply
After exploring the bug database I discovered that this bug has been
reported since March, and appears to derive from a bug in Python


It apparently only happens when the code generated by Makepy is really
big (which it is for Word or Excel).

So my options are to downgrade from Python 2.4.1 to 2.3.5 or to use
Late Binding instead of Early Binding (as described in Hammond and
Robinson, Ch. 12). The easiest path will be to use Early Binding,
because as far as I can tell the only significant changes to code will
be that I have to use integer literals instead of named constants. In
my case this means replacing
'win32com.client.constants.wdSendToNewDocument' with '0' (zero).

Oct 7 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Gerson Kurz | last post: by
1 post views Thread by Olaf Meding | last post: by
2 posts views Thread by nvhengr@gmail.com | last post: by
2 posts views Thread by Alexander Eisenhuth | last post: by
reply views Thread by gregarican | last post: by
4 posts views Thread by suzhi18@googlemail.com | last post: by
14 posts views Thread by Trent Mick | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.