[Tutor] Syntax error

Alan Gauld alan.gauld at btinternet.com
Mon Mar 23 09:35:13 CET 2009

"John Jenkinson" <johnjenkinson1 at gmail.com> wrote

>I am trying to write a program that displays the string expression 
> Over", in a console window that remains open.
> print "Game Over"
> raw input("\n\nPress the enter key to exit.")
> I dont understand what is supposed to happen if the code were to be
> correct.  Would a separate console be displayed with the text "Game 
> Over",
> or would I see the output in the Interactive Mode window?

This would display the Game Over message followed by the
Press enter key message in the window wghere the program was executing
and then wait for the user to hit the key before closing the window..

The problem you have is that I suspect you are using IDLE or Pythonwin
to write the code. These tools are development tools and not what you
would normally use to run the program. They do not display their 
in a window but rather do so in the interactive shell within the tool.

To see the program act as the auithor intended save the file with a
.py extension and then double click on it in Windows Explorer
(assuming you are on Windows!). This will open a Command window
with the program running inside.

Finally, to select error messages for posting you need to do something 
Start a command window (Start->Run, type CMD, hit OK). At the OS
command prompt type python and then drag your program file onto the 
This will run the program and leave the error message on screen. You 
can then
use the control menu(click on the window icon) Edit->Mark, Edit->Copy 
select the text and copy it to the clipboard so that you can paste it 
into a
mail message.


Alan G
Author of the Learn to Program web site

More information about the Tutor mailing list