Problem with py2exe when using bundle_files and pygtk/pygobject

sebastian.noack at googlemail.com sebastian.noack at googlemail.com
Thu Nov 27 10:03:57 CET 2008


Hi,

I am using py2exe with pygtk and everything works fine. But when I set
bundle_files to 1 or 2, I get following exception, when starting the
binary:

Traceback (most recent call last):
  File "startup.py", line 1, in <module>
  File "zipextimporter.pyc", line 82, in load_module
  File "foo.pyc", line 4, in <module>
  File "zipextimporter.pyc", line 82, in load_module
  File "gtk\__init__.pyc", line 38, in <module>
  File "zipextimporter.pyc", line 82, in load_module
  File "gobject\__init__.pyc", line 30, in <module>
  File "zipextimporter.pyc", line 82, in load_module
  File "gobject\constants.pyc", line 22, in <module>
  File "zipextimporter.pyc", line 98, in load_module
ImportError: MemoryLoadLibrary failed loading gobject\_gobject.pyd

I have found this error message under
http://www.py2exe.org/index.cgi/ProblemsToBeFixed with the comment
"This error occur when no msvcp71.dll found - add this dll to program
or windows/system32 director". But because of I am using Windows XP,
there is msvcp71.dll under C:\Windows\system32.

I figured out that gobject\_gobject.pyd is into the zipfile and
zipextimporter can even read it. But MemoryLoadLibrary as called by
import_module returns NULL.

I am using py2exe 0.6.9 for 32-bit with Python 2.5 on Windows XP SP2
and my setup.py is listed below.

    from distutils.core import setup
    import py2exe

    setup(name='foo',
           version='1.0',
           options= {
               'py2exe': {
                   'bundle_files': 1,
                   'includes': 'cairo, pango, pangocairo, atk,
gobject'
               }
           },
           windows = ['startup.py'],
           py_modules=['foo'])

This seems to me as a bug in the MemoryLoadLibrary code or I am doing
something wrong? Does somebody have successful bundled an application
using pygtk with py2exe and can tell me what has he done to do so and
which versions of py2exe, Python and Windows he was using? Thanks.

Regards
Sebastian Noack



More information about the Python-list mailing list