1

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.

3 Answers 3

2

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.

1
  • 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.
    – aneuryzm
    Sep 24, 2010 at 6:39
3

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

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .