Apr 28 2011, 08:33 PM
So... 1st question: Who here knows python?
2nd: Have you used PyGame to write games?
3rd: Have you then used py2exe to build the game into a single exe independent of python or any libraries?
If you have said yes to all of the above or think you can help, here is my problem:
so I have been writing this game for a while now and finally have it finished. However due to the fact that the game is meant for a class and I used libraries that my teacher isn't going to bother installing I need to make a single executable that will run independent of python and the games dependencies. I ran py2exe and it completed successfully however when I run the exe I get this error:
Traceback (most recent call last):
File "main.pyw", line 1, in <module>
File "zipextimporter.pyo", line 82, in load_module
File "libs\__init__.pyo", line 3, in <module>
WindowsError: [Error 3] The system cannot find the path specified: 'C:\\Users\\matt\\workspace\\COS125\\src\\dist\\includes.zip\\libs/*.*'
I have figured out what the most likely cause of the error is. It most likely stems from the auto importer I have installed for each package. In the __init__.py files for my packages I use the following code so that a simple "from libs import *" will import all the files in the lib package. This will make it so that each file will be loaded as if I loaded each one as "from libs.module import *".
The code in the __init__ file is as follows:
import os, sys
path = os.path.dirname(__file__)
dirList = os.listdir(path)
for mod in dirList:
ext = os.path.splitext(mod)
mod = mod[:-len(ext[1])]
if (mod not in dir() and
mod != "__init__" and
mod != "" and
mod != "._"):
exec("from " + mod + " import *")
Essentially what I am asking is if anyone else knows how to do this without resulting in that error after compiling?
My source code is right here (including the py2exe setup file):
http://nateshoemaker.com/matt/src.zip
NOTE: the code does run, but it requires python 2.6, pygame, and pymysql to be installed. It is rather sensitive to changes in environment.
2nd: Have you used PyGame to write games?
3rd: Have you then used py2exe to build the game into a single exe independent of python or any libraries?
If you have said yes to all of the above or think you can help, here is my problem:
so I have been writing this game for a while now and finally have it finished. However due to the fact that the game is meant for a class and I used libraries that my teacher isn't going to bother installing I need to make a single executable that will run independent of python and the games dependencies. I ran py2exe and it completed successfully however when I run the exe I get this error:
Traceback (most recent call last):
File "main.pyw", line 1, in <module>
File "zipextimporter.pyo", line 82, in load_module
File "libs\__init__.pyo", line 3, in <module>
WindowsError: [Error 3] The system cannot find the path specified: 'C:\\Users\\matt\\workspace\\COS125\\src\\dist\\includes.zip\\libs/*.*'
I have figured out what the most likely cause of the error is. It most likely stems from the auto importer I have installed for each package. In the __init__.py files for my packages I use the following code so that a simple "from libs import *" will import all the files in the lib package. This will make it so that each file will be loaded as if I loaded each one as "from libs.module import *".
The code in the __init__ file is as follows:
import os, sys
path = os.path.dirname(__file__)
dirList = os.listdir(path)
for mod in dirList:
ext = os.path.splitext(mod)
mod = mod[:-len(ext[1])]
if (mod not in dir() and
mod != "__init__" and
mod != "" and
mod != "._"):
exec("from " + mod + " import *")
Essentially what I am asking is if anyone else knows how to do this without resulting in that error after compiling?
My source code is right here (including the py2exe setup file):
http://nateshoemaker.com/matt/src.zip
NOTE: the code does run, but it requires python 2.6, pygame, and pymysql to be installed. It is rather sensitive to changes in environment.
Can I have a picture? ......So I can show Santa EXACTLY what I want for Christmas.