954,515 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Py2exe issues

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)
        setup(console=['hello.py'])
    File "C:\Python27\lib\distutils\core.py", line 152, in setup
        dist.run_commands()
    File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands
        self.run_command(cmd)
    File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
        cmd_obj.run()
    File "C:\Python27\lib\site-packages\py2exe\build_exe.py", line 243, in run
        self._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
        self.dll_excludes)
    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.
Thropian
Junior Poster in Training
96 posts since Oct 2010
Reputation Points: 13
Solved Threads: 2
 

Post your code,not only Traceback.

snippsat
Practically a Posting Shark
808 posts since Aug 2008
Reputation Points: 353
Solved Threads: 294
 

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.

Enalicho
Junior Poster in Training
62 posts since Aug 2011
Reputation Points: 28
Solved Threads: 13
 

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

hello.py

print "hello world"


and the setup.py

from distutils.core import setup
import py2exe

setup(name = "hello",
      console=['hello.py'])


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

Thropian
Junior Poster in Training
96 posts since Oct 2010
Reputation Points: 13
Solved Threads: 2
 

You've almost definitely installed the wrong version.

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

PS C:\> python
<strong>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.</strong>


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?

Enalicho
Junior Poster in Training
62 posts since Aug 2011
Reputation Points: 28
Solved Threads: 13
 

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

Thropian
Junior Poster in Training
96 posts since Oct 2010
Reputation Points: 13
Solved Threads: 2
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: