I have a Python application in a directory dir. This directory has a __main__.py file and several data files that are read by the application using open(...,'r'). Without editing the code, it it possible to bundle the code and data files into a single zip file and execute it using something like python app.pyz
- My goal is to share the file and data easily.
- Running the application using
python dirworks fine. - If I make a zip file using
python -m zipfile -c app.pyz dir/*, the resulting application will run but cannot read the files. This makes sense. - I can ask the customers to unzip the compressed folder before running or I could embed the files as strings within the code. That said, I'm curious of this can be avoided.
Can I bundle code and data into one file?