Jump to content
  • Advertisement
Sign in to follow this  

py2exe problem

This topic is 3957 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I tried compiling a game with py2exe, but it does not run... Can someone please help me? The error says there is no data folder inside the zip, but when i put the data folder inside the zip, there are more errors (inside the logfile)... I have no idea what to do since I'm kind of new to python... My setup.py script, log file, make_exe batch and pic of my files are as follows: SETUP.PY:
#!/usr/bin/env python

from distutils.core import setup

import os

# The main entry point of the program
script_file = 'PyGletSpace.py'

# Create a list of data files.  Add everything in the 'res/' directory.
data_files = []
for file in os.listdir('data'):
    file = os.path.join('data', file)
    if os.path.isfile(file):

# Setup args that apply to all setups, including ordinary distutils.
setup_args = dict(
    data_files=[('data', data_files)]

# py2exe options
    import py2exe
            icon_resources=[(1, 'assets/app.ico')],
except ImportError:


Traceback (most recent call last):
  File "PyGletSpace.py", line 343, in <module>
  File "PyGletSpace.py", line 48, in __init__
  File "PyGletSpace.py", line 55, in init_sprites
  File "PyGletSpace.py", line 273, in __init__
  File "PyGletSpace.py", line 220, in __init__
  File "helper.pyc", line 36, in load_image
  File "pyglet\image\__init__.pyc", line 169, in load
IOError: [Errno 2] No such file or directory: 'C:\\Users\\MyName\\workspace\\Pyglet game\\src\\dist\\library.zip\\data\\ship.png'

rem *** Used to create a Python exe 

rem ***** get rid of all the old files in the build folder
rd /S /Q build

rem ***** create the exe
c:\Python25\python setup.py py2exe

rem **** pause so we can see the exit codes
pause "done...hit a key to exit"

SCREENSHOT OF FILES BEFORE MAKING EXE: Photobucket SCREENSHOT OF DIST FOLDER AFTER MAKING EXE: Photobucket If someone can help me, I'd be really grateful...

Share this post

Link to post
Share on other sites
The error says it can't find the file, which is probably because it's inside a zip file rather than being on the filesystem like normal. If the end user installs your application instead of running it from one file, I expect it'll work fine. Or, it might just start working anyway when Pyglet 1.1 comes out with support for loading files from zips.

Generally if you're new to Python then Py2exe is the last thing you should be worrying about. Leave that until you're more familiar with things and need to distribute packages. You don't need it until then.

Share this post

Link to post
Share on other sites
Well the reason I'm interested in py2exe is to send my fiends who aren't developers ( or those who are computer-challenged )test versions of code for them to find errors etc...

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!