views:

559

answers:

3

I have a standard setup script for py2exe with which I bundle PyQt-based applications into Windows .exe files.

Today I tried a simple script that uses the PyQwt module, and it doesn't seem to work. py2exe runs alright, but when I execute the .exe it creates, it dumps the following into a log file and doesn't run:

Traceback (most recent call last):
  File "qwt_test.pyw", line 5, in <module>
  File "zipextimporter.pyo", line 82, in load_module
  File "PyQt4\Qwt5\__init__.pyo", line 32, in <module>
  File "zipextimporter.pyo", line 98, in load_module
ImportError: MemoryLoadLibrary failed loading PyQt4\Qwt5\Qwt.pyd

When I look in PyQt4\Qwt5\ in the build\bdist.win32\winexe\collect-2.5 directory, Qwt.pyd is definitely there.

I can't seem to find anything useful online regarding this error. What could cause it? Thanks.

+4  A: 

py2exe is not the only way, and maybe not the best way, to put together exe files for Python apps -- in particular, it hardly if at all supports pyqt. Please, I beseech you, check out PyInstaller, which DOES know about PyQt (and Linux, and Mac, should you care...) -- just make sure you use the SVN head checkout, not the "released" version, which at this time is seriously out of date (an issue that's hopefully going away soon...).

Alex Martelli
Alex, py2exe works just fine with PyQt for me, it's only the PyQwt part that's causing problems. Why do you prefer PyInstaller? To me it seems less supported, less updated and a bit archaic to use.
Eli Bendersky
Used to be (less supported -). Once you svn co http://svn.pyinstaller.org/trunk pyinstaller, pyinstaller/doc/CHANGES.txt lists the many changes since 1.3. I just hope they make a release soon!-)
Alex Martelli
I've worked with PyInstaller before, and in fact it managed to pack the PyQwt app correctly. But I was always disappointed at the lack of support. Having to download from SVN is not a sign of a healthy project. I hope you're right though and they'll improve it soon.
Eli Bendersky
Hey, you've got some of the current developers' emails now (the bunch of Italian programmers mentioned at the above URLs) -- why not let them know directly, the more users they hear it from, the likelier they are to decide to release (-) instead of continuing to pile on features...!-)
Alex Martelli
+1  A: 

Some options:

  1. Try playing with the py2xe bundle_files options (3, 2, 1) (especially if you put them all in one big library zip, some dlls don't like that).
  2. Make sure a copy of msvcp71.dll exists under windows\system32 or in the directory of your executable.
  3. Try excluding the dll explicitely (add Qwt.pyd to the dll_excludes option and (after building) copy Qwt.pyd (and _Qwt.pyd if it exists) to your executable path.
ChristopheD
A: 

I've built these before, and haven't needed to do anything special beyond the normal PyQt stuff. Can you post your setup.py?