Ive been tinkering around all day with solutions from here and here:
How would I combine multiple .py files into one .exe with Py2Exe
Packaging multiple scri
Following setup.py (in the source dir):
from distutils.core import setup
import py2exe
setup(console = ['multiple.py'])
And then running as:
python setup.py py2exe
works fine for me. I didn't have to give any other options to make it work with multiple scripts.
You can really use py2exe, it behaves the way you want.
See answer to the mentioned question: How would I combine multiple .py files into one .exe with Py2Exe
Usually, py2exe bundles your main script to exe file and all your dependent scripts (it parses your imports and finds all nescessary python files) to library zip file (pyc files only). Also it collects dependent DLL libraries and copies them to distribution directory so you can distribute whole directory and user can run exe file from this directory. The benefit is that you can have a large number of scripts - smaller exe files - to use one large library zip file and DLLs.
Alternatively, you can configure py2exe to bundle all your scripts and requirements to 1 standalone exe file. Exe file consists of main script, dependent python files and all DLLs. I am using these options in setup.py to accomplish this:
setup(
...
options = {
'py2exe' : {
'compressed': 2,
'optimize': 2,
'bundle_files': 1,
'excludes': excludes}
},
zipfile=None,
console = ["your_main_script.py"],
...
)
Working code:
from distutils.core import setup
import py2exe, sys, os
sys.argv.append('py2exe')
setup(
options = {
'py2exe' : {
'compressed': 1,
'optimize': 2,
'bundle_files': 3, #Options 1 & 2 do not work on a 64bit system
'dist_dir': 'dist', # Put .exe in dist/
'xref': False,
'skip_archive': False,
'ascii': False,
}
},
zipfile=None,
console = ['thisProject.py'],
)