[Tutor] Print Output Location in Windows XP

Alan G alan.gauld at freenet.co.uk
Sat Sep 3 09:31:08 CEST 2005

> Up until now I have been running my Python programs in Linux. I just
> wrote one in Windows XP and I can't find the print output. The 
> Python program has a print statement, and when I run the program a 
> black window opens and I can see printing going on.

Thats a standard Windows command box. Print goes to stdout which 
in that box. You can hide the box by renaming your script .pyw and 
you won't see your print output at all!

> However, when it's finished printing, the output window closes.
> How do I get the output window to stay open, or where is the output 
> stored?

There are several approaches to this, starting with the easiest:

1) Run the program from an existing command prompt

2) Use a raw_input('Hit ENTER to close...') line at the end of your 

3) Modify the file assosciation to run the ptrogram with pyhon -i
   This leaves you in the python interpreter at the end of the
   run - useful for debugging

4) Create a shortcut to your script and use that to run it,
   modify the shortcut to not close the window when finished.


BTW What happened on Linux? If you run a python program by double
clicking the script file from a GUI where does stdout go? I've never
tried that, being a command line junkie, but surely a similar prooblem

Alan G
Author of the Learn to Program web tutor

More information about the Tutor mailing list