From: Michael Foord <mike@pc...> - 2005-01-11 11:15:17
We're trying to get the pywin32 extensions (specifically the win32com
extensions) working with Movable Python. We're encountering some
slightly 'odd' problems.
My understanding is that these extensions work with py2exe - so these
issues must have been resolved by py2exe already.
We are copying all the pywin32 extensions into a directory that is on
sys.path. pywin32 is still failing to find some of the extensions - it
fails to import win32com.shell for example. The essence of the question
is - how do we let pywin32 know where all it's files are ?
First off it should be noted that pywin32 makes the following
directories in a normal distribution's site-packages directory:
and adds a few files to the root of site-packages (pythoncom.py,
After moving the above files & directories to the appropriate location
in Movable Python, I added the paths in pywin32.pth to Movable
Python's syspaths.pth. Now it's okay to get rid of pywin32.pth.
Now, it won't let me import pythoncom just yet -- it complains that
'pythoncom isn't in frozen sys.path.' Moving pythoncom24.dll from the
pywin32_system32 directory to MovPy's root lib directory (to join the
existing pywintypes24.dll) fixes this. Now it's okay to get rid of the
pywin32_system32 directory (so it seems).
Now I can import pythoncom and win32com -- but this is where the
trouble starts! win32com itself has modules such as shell, ifilter,
internet, and mapi to name a few. Instead of keeping these in its own
(win32com) directory, it puts them in the separate win32comext
directory. To find out about this separate directory, it seems to
consult the registry. As I said, I can import win32com, but trying to
import, for example, win32com.shell fails (no module named shell).
I find this (that it fails) odd because after looking at the code, it
looks like after failing to find the appropriate registry key it
defaults to the 'win32comext' directory, so shouldn't it find 'shell'?
Also, I *do* actually have the entries in my registry because I have
pywin32 installed (and working) on my standard Python distribution.
So even if the paths stored in the registry are absolute instead of
relative, it should be able to load the win32com extensions.
This is actually a report from a user. But it is an issue I'm keen to
resolve. If no-one here can help then I'll try and find the pywin32
mailing list. However, if these extensions work with py2exe then this
issue must have been resolved with py2exe.