Python Forum
Create .exe with program.py - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Create .exe with program.py (/thread-22247.html)



Create .exe with program.py - preliator - Nov-05-2019

Good morning all,

I want to create an .exe file with my Python program, so I can use it anywhere.

I installed pyinstaller, started the command on my program.py, several files were created (dist, build, etc). Everything goes well.

However, when I run the .exe file "dist", I do not have time to see the result of my program that it closes live. Maybe it is necessary to add a command line in my program so that it is put in "pause"?

In C, I remember that this command was more or less like this:

Quote:system ( "pause")



RE: Create .exe with program.py - ThomasL - Nov-05-2019

Maybe you are looking for this: time.sleep()


RE: Create .exe with program.py - buran - Nov-05-2019

there are two possibilities - either your program finishes too fast or there is problem and your exe actually crashes.

to see if it is the former - don't run it by double-click with mouse, but open cmd, change current working directory to one where your exe is and run it from command prompt. This way it will not close the cmd when the execution ends
in this case you can add
input('Press any key...')
at the end and it will wait to press a key before execution ends.