Hey all, as the thread title suggests, I am having some problems with compiling a script into a native windows executable. Basically, I can compile and run just fine if I do not use the bundle option. However, upon activating the bundle option, the program will crash with a non-descript error (i.e. [program] "has encountered a problem and needs to close. We are sorry for the inconvenience.") Basically I would like to know why this happens and if there is any known way to fix it, or if I am doomed to distribute my application with ~15 extra files? Here's the setup script if it helps (I doubt it):
Then I run it with this in a BAT file:
I've looked around the net and haven't found any solutions to this problem, so I resorted to asking the question myself, hence this thread right here. Let me know if any additional info is required for you to understand my problem.
(Of possible note: I can assemble "Hello World" with bundled files, it's just when I use python card that it has problems)
Edit: Oh yeah, I forgot to mention: If there is no way to do this with py2exe, is there a better exe creator (such as pyinstaller) that would be able to do this for me? What would you recommend?
Code:
from distutils.core import setup
import py2exe
import sys
import os
filename = "File.py"
if filename.endswith(".py"):
distribution = "File"
elif filename.endswith(".pyw"):
distribution = filename[:-4]
if len(sys.argv) == 1:
sys.argv.append("py2exe")
sys.argv.append("-q")
includes=[]
for comp in ['button','image','staticbox',\
'statictext','textarea','textfield','passwordfield','bitmapcanvas',\
'radiogroup','choice','checkbox']:
includes += ['PythonCard.components.'+comp]
pycard_resources=["File.rsrc.py"]
for filename in os.listdir('.'):
if filename.find('.rsrc.')>-1:
pycard_resources+=[filename]
dest_file = "File" # Final name of .exe file
dest_folder = "Folder"
opts = { 'py2exe': { 'includes':includes,
"compressed": 1,
"optimize": 2,
"bundle_files": 1,
"ascii": 1,
"dist_dir": dest_folder,}}
setup(name='File',
version='1.0',
url='about:none',
author='HuFlungDu',
package_dir={'blarg':'.'},
packages=['blarg'],
data_files=[('.',pycard_resources)],
console=['File.py'],
options=opts,
zipfile = None,
)
Then I run it with this in a BAT file:
Code:
wx2exeZ.py py2exe --excludes=Image
@pause
I've looked around the net and haven't found any solutions to this problem, so I resorted to asking the question myself, hence this thread right here. Let me know if any additional info is required for you to understand my problem.
(Of possible note: I can assemble "Hello World" with bundled files, it's just when I use python card that it has problems)
Edit: Oh yeah, I forgot to mention: If there is no way to do this with py2exe, is there a better exe creator (such as pyinstaller) that would be able to do this for me? What would you recommend?
Last edited: