[Tutor] what is it mean--- File "<stdin>", line 1

Corey Richardson kb1pkl at aim.com
Mon Mar 21 02:14:23 CET 2011


 I just write a simplest file test.py with only one line--print 
"hello", when I run it in command line:
>>> python test.py

the follow message comes out:

File "<stdin>" , line 1
 python test

SyntaxError: invalid syntax

but, the file can run in shell, also in the command line, I put

>>> print "hello"

output is fine, "Hello"



You're trying to run the file from the Python interpreter.
It does work in the shell, because that's what the shell does!
So, exit out of the Python interpreter before trying to run that command
(>>>exit, or Ctrl-D).

Corey Richardson
(Forgive the horrible formatting and HTML, on the road using a web 


More information about the Tutor mailing list