app runs fine with interpreter, but not under py2exe
haraldarminmassa at gmail.com
Sun Mar 16 08:33:31 CET 2008
> as I quickly noticed that "library.zip" does NOT contain ANY .pyd files.
> I'm guessing that they can't be in library.zip for a reason (i.e., they are
> DLL files, essentially, and thus must be readily available to be loaded
> into memory).
.dll and .pyd files CAN be within library.zip and even within the
There is some Hellermagic within _memimporter.pyd that loads the .dll
and .pyd from a zipfile. When you scan the build_exe.py, you will
print "*** finding dlls needed ***"
dlls = self.find_dlls(extensions)
self.plat_finalize(mf.modules, py_files, extensions, dlls)
dlls = [item for item in dlls
if os.path.basename(item).lower() not in
# should we filter self.other_depends in the same way?
> Is there a work-around for this, then?
-rwxr-xr-x 1 morse None 26624 Nov 28 2006 dist/multiarray.pyd
-rwxr-xr-x 1 morse None 348160 Nov 8 16:16 dist/numpy/core/
-rwxr-xr-x 1 morse None 192512 Nov 8 16:16 dist/numpy/core/
-rwxr-xr-x 1 morse None 54272 Nov 28 2006 dist/umath.pyd
let's try: your mission is, should you chose to accept it, to make a
py2exed application to load two different multiarray.pyd, who are on
the visible level only different by their place in the file system.
So, please make a minimal script:
import numpy.core.multiarray as ncmultiarray
and, using Peters test
>>> from multiarray import zeros
assert zeros((1,), "1") == array(, '1')
and check, if those multiarrays are the correct ones. If yes, you can
try to build upon this by making all imports explicit as described
above. (Yes, I know, that's not necessary in plain python ... but it
saved me in some weird "import from .zip" and "import from database"
> (a) tell py2exe how to *correctly* handle multiple multiarray.pyd and
> umath.pyd files
somewhere deep inside I have a BAAAD feeling about to files having the
same name but very very different content - but that's not your call
in this situation.
Are you able to build that libraries yourself? Then you could move
down and build the multiarray.pyd as ncmultiarray.pyd and adjust all
imports accordingly. (lots of work)
> manual create the "stub"-like .pyc files that py2exe creates to point to
> these alternate .pyd files and then place these stubs in
As much as I know there is only one central "loader stub", which
ensures that .dlls get imported from memory, see above. py2exe does
not create something like p2elma.py containing "import multiarray.pyd"
best luck, and please take your time to scan the py2exe.org wiki,
there are many similiar challanges with various packages, maybe you
get another workaround-idea (and, if we find one, PLEASE put it down
there for others to learn)
More information about the Python-list