COM makepy broken in ActivePython 2.3.2?

G

Gerson Kurz

I have problems getting "COM makepy" working in ActivePython 2.3.2.
This is what happens when I start "COM makepy" from the Pythonwin
Menu:

PythonWin 2.3.2 (#49, Nov 6 2003, 10:18:20) [MSC v.1200 32 bit
(Intel)] on win32.
Portions Copyright 1994-2001 Mark Hammond ([email protected])
- see 'Help/About PythonWin' for further copyright information.from win32com.client import makepy;makepy.main()
Traceback (most recent call last):
File
"C:\Python23\Lib\site-packages\Pythonwin\pywin\framework\toolmenu.py",
line 103, in HandleToolCommand
exec "%s\n" % pyCmd
File "<string>", line 1, in ?
File "C:\Python23\Lib\site-packages\win32com\client\__init__.py",
line 12, in ?
import dynamic, gencache, pythoncom
File "C:\Python23\Lib\site-packages\win32com\client\gencache.py",
line 623, in ?
__init__()
File "C:\Python23\Lib\site-packages\win32com\client\gencache.py",
line 52, in __init__
Rebuild()
File "C:\Python23\Lib\site-packages\win32com\client\gencache.py",
line 610, in Rebuild
_SaveDicts()
File "C:\Python23\Lib\site-packages\win32com\client\gencache.py",
line 57, in _SaveDicts
raise RuntimeError, "Trying to write to a readonly gencache
('%s')!" \
RuntimeError: Trying to write to a readonly gencache
('C:\TEMP\gen_py\2.3')!
---------------------------------------------------

OK, so I figure it wants to write to C:\TEMP\gen_py (why? IIRC this
used to be buried somewhere along the site-packages). I create the
directory & import a class. This is what happens:

Generating to
C:\TEMP\gen_py\2.3\08EF934A-521D-4E29-A92F-0FDE92DDE9D6x0x1x0.py
Failed to execute command:
from win32com.client import makepy;makepy.main()
Traceback (most recent call last):
File
"C:\Python23\Lib\site-packages\Pythonwin\pywin\framework\toolmenu.py",
line 103, in HandleToolCommand
exec "%s\n" % pyCmd
File "<string>", line 1, in ?
File "C:\Python23\Lib\site-packages\win32com\client\makepy.py", line
362, in main
GenerateFromTypeLibSpec(arg, f, verboseLevel = verboseLevel,
bForDemand = bForDemand, bBuildHidden = hiddenSpec)
File "C:\Python23\Lib\site-packages\win32com\client\makepy.py", line
273, in GenerateFromTypeLibSpec
gencache.AddModuleToCache(info.clsid, info.lcid, info.major,
info.minor)
File "C:\Python23\Lib\site-packages\win32com\client\gencache.py",
line 514, in AddModuleToCache
mod = _GetModule(fname)
File "C:\Python23\Lib\site-packages\win32com\client\gencache.py",
line 590, in _GetModule
mod = __import__(mod_name)
File
"C:\TEMP\gen_py\2.3\08EF934A-521D-4E29-A92F-0FDE92DDE9D6x0x1x0.py",
line 12, in ?
from win32com.client import Dispatch
ImportError: cannot import name Dispatch
---------------------------------------------------

Now when I try this:

import win32com.client
instance = win32com.client.Dispatch("...")

it tells me that Dispatch is not found ???? I restart pythonwin &
python2.3.2 & win32all "out of the box" before and didn't have any of
these problems. So, is "COM makepy" broken in AP232?
 
M

Mark Hammond

Gerson said:
I have problems getting "COM makepy" working in ActivePython 2.3.2.
This is what happens when I start "COM makepy" from the Pythonwin
Menu:

PythonWin 2.3.2 (#49, Nov 6 2003, 10:18:20) [MSC v.1200 32 bit
(Intel)] on win32.
Portions Copyright 1994-2001 Mark Hammond ([email protected])
- see 'Help/About PythonWin' for further copyright information.

from win32com.client import makepy;makepy.main()
Traceback (most recent call last):
File
"C:\Python23\Lib\site-packages\Pythonwin\pywin\framework\toolmenu.py",
line 103, in HandleToolCommand
exec "%s\n" % pyCmd
File "<string>", line 1, in ?
File "C:\Python23\Lib\site-packages\win32com\client\__init__.py",
line 12, in ?
import dynamic, gencache, pythoncom
File "C:\Python23\Lib\site-packages\win32com\client\gencache.py",
line 623, in ?
__init__()
File "C:\Python23\Lib\site-packages\win32com\client\gencache.py",
line 52, in __init__
Rebuild()
File "C:\Python23\Lib\site-packages\win32com\client\gencache.py",
line 610, in Rebuild
_SaveDicts()
File "C:\Python23\Lib\site-packages\win32com\client\gencache.py",
line 57, in _SaveDicts
raise RuntimeError, "Trying to write to a readonly gencache
('%s')!" \
RuntimeError: Trying to write to a readonly gencache
('C:\TEMP\gen_py\2.3')!
---------------------------------------------------

OK, so I figure it wants to write to C:\TEMP\gen_py (why? IIRC this
used to be buried somewhere along the site-packages). I create the
directory & import a class. This is what happens:

Generating to
C:\TEMP\gen_py\2.3\08EF934A-521D-4E29-A92F-0FDE92DDE9D6x0x1x0.py
Failed to execute command:
from win32com.client import makepy;makepy.main()
Traceback (most recent call last):
File
"C:\Python23\Lib\site-packages\Pythonwin\pywin\framework\toolmenu.py",
line 103, in HandleToolCommand
exec "%s\n" % pyCmd
File "<string>", line 1, in ?
File "C:\Python23\Lib\site-packages\win32com\client\makepy.py", line
362, in main
GenerateFromTypeLibSpec(arg, f, verboseLevel = verboseLevel,
bForDemand = bForDemand, bBuildHidden = hiddenSpec)
File "C:\Python23\Lib\site-packages\win32com\client\makepy.py", line
273, in GenerateFromTypeLibSpec
gencache.AddModuleToCache(info.clsid, info.lcid, info.major,
info.minor)
File "C:\Python23\Lib\site-packages\win32com\client\gencache.py",
line 514, in AddModuleToCache
mod = _GetModule(fname)
File "C:\Python23\Lib\site-packages\win32com\client\gencache.py",
line 590, in _GetModule
mod = __import__(mod_name)
File
"C:\TEMP\gen_py\2.3\08EF934A-521D-4E29-A92F-0FDE92DDE9D6x0x1x0.py",
line 12, in ?
from win32com.client import Dispatch
ImportError: cannot import name Dispatch
---------------------------------------------------

Now when I try this:

import win32com.client
instance = win32com.client.Dispatch("...")

it tells me that Dispatch is not found ???? I restart pythonwin &
python2.3.2 & win32all "out of the box" before and didn't have any of
these problems. So, is "COM makepy" broken in AP232?

Try creating a "gen_py" directory under the installed win32com
directory. The directory need only exist, not contain anything. This
should make it start working. I'm not sure if the recent APy update
fixed that...

Mark.
 
G

Gerson Kurz

Try creating a "gen_py" directory under the installed win32com
directory. The directory need only exist, not contain anything. This
should make it start working. I'm not sure if the recent APy update
fixed that...

You are right, this fixes both problems. So maybe the installer does
not correctly create the directory? Anyway, many thanks!
 
T

Trent Mick

[Gerson Kurz wrote]
You are right, this fixes both problems. So maybe the installer does
not correctly create the directory? Anyway, many thanks!

Yes, ActivePython 2.3.2 build 231 for Windows had this bug. A new build
was recently released (build 232) that fixed this issue.

Trent
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top