re: How to convert .py to .exe? Step by step guide. VIEW POST


Great post!

I load variables from a config.py file. How would I enable users to modify this file OUTSIDE the .exe?


Don't pack it into .exe file. Leave it outside .exe. It should work that way.


Thanks for your quick response!

How can I leave the config.py file outside? I feel that PyInstaller loads the config.py file, compiles it into the exe and then has this fixed state in the program. I need to be able to modify the config file, after compiling.

How do I instruct PyInstaller to leave the config.py file separate?

You are right about fixed state. What PyInstaller remembers is the name of the file. So if you paste the same file with different content(some .txt maybe) it will work with it just fine because it thinks it is the same file.

That would be amazing and a super easy solve. Problem: I cannot find the config.py in the folder that was created by PyInstaller. Actually I can't find any of the modules I import. Are they merged into the .exe file?

You should add files manually sometimes. Try copying config there. It should work.

It does not work. When I manually add the config.py, the file is added - yes. But when I change variables in the file, nothing changes in the program. The .exe does not load data from the config.py

Make sure you added the fie to Auto PY to EXE additional files menu for it to be compilated with .exe.

I changed my config file to .json and now it works. Even with adding the file manually, it does NOT work when the file is .py (the file was in the folder, but changing settings did not reflect in the script).

Code of Conduct Report abuse