简体   繁体   中英

Py2exe bundling files into a single exe

I'm having some trouble getting Py2exe to bundle all the files into a single .exe. It works fine for me when I don't bundle them together. So this is the setup.py script I use when I'm not bundling them together, and it always works:

from distutils.core import setup
import py2exe
setup(console=['test.py'])

So I wanted to bundle all the files into a single executable, so I used this setup.py script for that, and this is the one that doesn't work:

from distutils.core import setup
# I took this off the Internet
import py2exe, sys, os
sys.argv.append('py2exe')
setup(
    options = {'py2exe': {'bundle_files': 1}},
    windows = [{'script': "test.py"}],
    zipfile = None,
)

When I run this script, a dist directory is created with the test.exe file. If I execute it by typing "test.exe" this error message pops up:

See the logfile 'c:\Python26\dist\test.ext.log' for details

And this is the contents of that logfile:

Traceback (most recent call last):
File "test.py", line 1, in <module>
EOFError: EOF when reading a line

So does anyone know how I can do this? I just want to bundle all the files Py2exe generates with test.py into a single executable. I know it can do this. Or are there any other ways in which this can be done?

just from the errorlog message, could you try again after assuring the last line of test.py ends with a carriage return? (press enter after the last line in test.py and save again)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM