I'm hoping I'm not the first to deal with this issue but here goes.

running py2exe I get this error

Traceback (most recent call last):
    File "setup.py", line 4, in (module)
    File "C:\Python27\lib\distutils\core.py", line 152, in setup
    File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands
    File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
    File "C:\Python27\lib\site-packages\py2exe\build_exe.py", line 243, in run
    File "C:\Python27\lib\site-packages\py2exe\build_exe.py", line 305, in _run
        dlls = self.find_dlls(extensions)
    File "C:\Python27\lib\site-packages\py2exe\build_exe.py", line 389, in find_dlls
    File "C:\Python27\lib\site-packages\py2exe\build_exe.py", line 1021, in find_dependend_dlls
        import py2exe_util
ImportError: DLL load failed: %1 is not a valid Win32 application.

Post your code,not only Traceback.

Member Avatar

When posting your code, could you also post -

Your system's architecture (32 or 64 bit)
The version of Python you're using, along with the architecture
The version of py2exe you're using, along with the architecture.

I was using the example/tutorial codes on the py2exe website so


print "hello world"

and the setup.py

from distutils.core import setup
import py2exe

setup(name = "hello",

I'm using python2.7 and py2exe 0.6.9
and I don't know how to check the architecture (or really what that is) so sorry for not posting those

Member Avatar

You've almost definitely installed the wrong version.

At your command prompt, type "python", for example -

PS C:\> python
[B]Python 2.7.1 (r271:86832, Nov 27 2010, 17:19:03) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.[/B]

Copy and paste the output here.

As for working out the architecture of your OS,
Open Control Panel
Go to System
Look at "System Type"
Post what it says there.

And finally, could you post the _filename_ of the installer for py2exe that you used?

ok thanks guys.
I only saw the one download on py2exe's website.
the correct install did fix the issues.