Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm using Python in Windows XP.

I'm running a python program by double clicking on it since it is a shared folder and I cannot refer to that file from terminal.

It works well, but the terminal window is now closing when the app quits and I cannot debug properly.

I've tried to use a batch file with statement "pause" but I have some issues with the application. I was wondering if there is an option in python to specify to pause the application in the terminal before to quit it.

share|improve this question

3 Answers 3

up vote 2 down vote accepted

The typical way to pause terminal output is to print a prompt such as : "Hit enter to continue" and then do a readln from the terminal device.

share|improve this answer
    
yeah but the point is that I need to add a prompt statement in the code to each exception then, because the terminal quits when the program ends, and the program can end with an exception. –  Patrick Sep 24 '10 at 6:39

Open up a terminal window and type python followed by the path to the .py script:

python \\serverName\shareName\subdir\myscript.py
share|improve this answer
    
This should be flagged as the correct answer. –  qroberts Dec 17 '10 at 14:46
import atexit
atexit.register(lambda: raw_input("Press Enter."))
share|improve this answer
    
The Low quality review queue would like you to expand your answer a little ;) –  slhck Jul 16 '12 at 14:31
2  
The other side of the Low quality review queue thinks this answer is reasonable if you know Python. –  Tom Wijsman Jul 17 '12 at 18:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.