Size: 972
Comment:
|
← Revision 3 as of 2011-05-05 19:25:47 ⇥
Size: 1286
Comment: Attempted to answer the question, tidying it up a bit.
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
## Replace the ... text below with a title and a summary of the problem. ## Feel free to remove any remaining comments once you're done! |
= Asking for Help: How do I stop the console/terminal/command line prompt from closing on Windows? = |
Line 4: | Line 3: |
= Asking for Help: ... = | 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 |
Line 6: | Line 5: |
... | ---- |
Line 8: | Line 7: |
## Insert your problem description here. You may provide code samples using syntax like this: ## {{{#!python 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: |
Line 13: | Line 9: |
## Leave the note below so that editors can follow the instructions... {{{#!wiki note When ''answering'' questions, add the CategoryAskingForHelpAnswered category when saving the page. This will move the link to this page from the questions section to the answers section on the [[Asking for Help]] page. |
{{{#!python numbers=disable raw_input("Press Enter to exit.") |
Line 19: | Line 13: |
I found a [[http://stackoverflow.com/questions/2322868/how-do-i-prevent-my-python-2-6-application-from-automatically-closing-once-reachi|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). |
|
Line 20: | Line 16: |
CategoryAskingForHelp CategoryAskingForHelp | CategoryAskingForHelp CategoryAskingForHelpAnswered |
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).