I have attempted to convert my python program into a .app using PyInstaller. The actual code runs fine through IDLE, but everytime I try and run the newly converted .app, it clo
I had the same problem as you even though I knew my code wasn't supposed to close immediately since it waited for user_input. When I ran my code from the terminal using python my_script.py
the program would run fine.
Here is how I fixed it:
I reinstalled pyinstaller using:
pip install pyinstaller
I think that this was my main thing because the first time I installed it, I believe my antivirus prevented some of the components from installing correctly and when I reinstalled it, it probably patched in the holes.
I also tried a different command-line command. I explicitly stated for the final .exe to open a console and keep it open using the -c
flag.
Note: On Windows, this option will have no effect if the first script is a ‘.pyw’ file.
It looked like this:
pyinstaller -c -F -i cm_icon.ico console_monopoly.py
the -F flag was to bundle everything into one .exe instead of having a lot of files surrounding my .exe in the dist/ folder.
the -i flag is for adding an icon to my program.
Hope this helps!