Support Forums

Full Version: Window closes when opened
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I used to know how to prevent this, but now I haven't used python forever and I have no idea Confused

Does anyone know how to stop it from closing?
You are double clicking the python file?
If so you are getting an error.

To stop it either use IDLE (The IDE that comes with Python) or run it through the command prompt.
I found out a while ago, and yeah it was an error

But just for people who have problems with it closing right when it ends

Code:
import os
os.system("PAUSE")

makes it stay open until you close it
Or you could use raw_input("") so the user has to press enter afterward.
Pause does the same thing?
If you put raw input you can close it by just pressing enter.
It's easier IMO.