Hi,
I am a newbie in python, and i am currently using py2exe in Windows and python 2.5 platform. The problem is, my python code is residing in several subdirectories (1 folder for images, 1 for other .py files etc) as I am trying to make them as plugins. Currently, I have created a lib folder to store all the .py files i needed to run (1 py file per game). The flow is something like this GameFolder->lib->game1.py The main file would be in game folder, and it would get those other games from the lib folder. Now, I would like to use py2exe to create an exe file. However, after i run py2exe, the exe created can't run, as it states that it couldn't find the images, or the py files it's suppose to call. I tried using data_files to insert those files, and when i check, they are there. I think the problem lies in the fact that I did not explicitly state I import those files in the main python file (game.py).
Below are examples of the errors i got when i click open game.exe i created with py2exe:
error: Couldn't open C:\Documents and Settings\Administrator\Desktop\game\dist\game.exe\Data\loading_splash.jpg
WindowsError: [Error 3] The system cannot find the path specified: 'C:\\Documents and Settings\\Administrator\\Desktop\\game\\dist\\game.exe\\lib/*.*'
And within my setup.py, i got this:
setup(options = {"py2exe": {"optimize": 2, "bundle_files": 1}},
zipfile=None,
windows=["game.py"],
data_files=[("Data",glob.glob("Data/*.*")),
....................
("lib",glob.glob("lib/*.*")),
....................
Anybody got any idea how to code the setup.py? Thanks in advance.
I am a newbie in python, and i am currently using py2exe in Windows and python 2.5 platform. The problem is, my python code is residing in several subdirectories (1 folder for images, 1 for other .py files etc) as I am trying to make them as plugins. Currently, I have created a lib folder to store all the .py files i needed to run (1 py file per game). The flow is something like this GameFolder->lib->game1.py The main file would be in game folder, and it would get those other games from the lib folder. Now, I would like to use py2exe to create an exe file. However, after i run py2exe, the exe created can't run, as it states that it couldn't find the images, or the py files it's suppose to call. I tried using data_files to insert those files, and when i check, they are there. I think the problem lies in the fact that I did not explicitly state I import those files in the main python file (game.py).
Below are examples of the errors i got when i click open game.exe i created with py2exe:
error: Couldn't open C:\Documents and Settings\Administrator\Desktop\game\dist\game.exe\Data\loading_splash.jpg
WindowsError: [Error 3] The system cannot find the path specified: 'C:\\Documents and Settings\\Administrator\\Desktop\\game\\dist\\game.exe\\lib/*.*'
And within my setup.py, i got this:
setup(options = {"py2exe": {"optimize": 2, "bundle_files": 1}},
zipfile=None,
windows=["game.py"],
data_files=[("Data",glob.glob("Data/*.*")),
....................
("lib",glob.glob("lib/*.*")),
....................
Anybody got any idea how to code the setup.py? Thanks in advance.