⇤ ← Revision 1 as of 2004-01-21 15:51:37
Size: 2303
Comment: initial creation
|
Size: 2299
Comment: Again, markup fixes.
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
= The Problem = | = The Problem = |
Line 31: | Line 31: |
= Explanation = | = Explanation = |
Line 33: | Line 33: |
win32com does some magic. There really is no win32com.shell anywhere. | win32com does some magic. There really is no win32com.shell anywhere. |
Line 87: | Line 87: |
And this worked. | And this worked. |
The Problem
I used [http://tgolden.sc.sabren.com/python/winshell.html winshell] from Tim Golden - a thin wrapper around Windows Shell-Functions.
winshell.py starts with
py2exe learns, that something is missing:
The following modules appear to be missing ['Interface', 'intSet', 'mxDateTime.__version__', 'win32com.shell']
and starting the programm leaves:
Traceback (most recent call last): File "xxxxxx.py", line 33, in ? File "xxxxxxx.pyo", line 9, in ? File "winshell.pyo", line 27, in ? ImportError: No module named shell
}
in the log.file.
Explanation
win32com does some magic. There really is no win32com.shell anywhere.
Solution
Without shame I browsed [http://cvs.sourceforge.net/viewcvs.py/spambayes/ spambayes source code] and found:
1 # ModuleFinder can't handle runtime changes to __path__, but win32com uses them,
2 # particularly for people who build from sources. Hook this in.
3 try:
4 import modulefinder
5 import win32com
6 for p in win32com.__path__[1:]:
7 modulefinder.AddPackagePath("win32com", p)
8 for extra in ["win32com.shell","win32com.mapi"]:
9 __import__(extra)
10 m = sys.modules[extra]
11 for p in m.__path__[1:]:
12 modulefinder.AddPackagePath(extra, p)
13 except ImportError:
14 # no build path setup, no worries.
15 pass
I just added that in top of my setup.py file:
1 # By default, the installer will be created as dist\Output\setup.exe.
2
3 import time
4 import sys
5
6 # ModuleFinder can't handle runtime changes to __path__, but win32com uses them,
7 # particularly for people who build from sources. Hook this in.
8 try:
9 import modulefinder
10 import win32com
11 for p in win32com.__path__[1:]:
12 modulefinder.AddPackagePath("win32com", p)
13 for extra in ["win32com.shell"]: #,"win32com.mapi"
14 __import__(extra)
15 m = sys.modules[extra]
16 for p in m.__path__[1:]:
17 modulefinder.AddPackagePath(extra, p)
18 except ImportError:
19 # no build path setup, no worries.
20 pass
21
22 from distutils.core import setup
23 import py2exe
And this worked.