This is a static archive of the Python wiki, which was retired in February 2026 due to lack of usage and the resources necessary to serve it — predominately to bots, crawlers, and LLM companies.
Pages are preserved as they were at the time of archival. For current information, please visit python.org.
If a change to this archive is absolutely needed, requests can be made via the infrastructure@python.org mailing list.

Asking for Help: How do I stop the console/terminal/command line prompt from closing on Windows?

Ok so, Let's say I want to run a program with a simple Print("hello world"). How do I stop the console/terminal/command line prompt from closing immediately after it prints? I read somewhere that I'm supposed to find some editpythonprefs, but I don't know where it is... I am on Windows 7, if that helps


Are you running the program from the file manager or do you already have the console open when running the program (by typing python hello.py, for example)? If the former is involved, which I suspect is the case, you could prevent the program from finishing by inserting something like the following at the end:

raw_input("Press Enter to exit.")

I found a question about this by searching the Internet for "prevent Python program from exiting on Windows". You'll find other more complicated suggestions if you follow various links from that question, but sometimes the simplest solutions are the best (or are at least good enough).


CategoryAskingForHelp CategoryAskingForHelpAnswered


2026-02-14 16:06