Why am I getting a SyntaxError in the Python interpreter?
Posted
by michael
on Stack Overflow
See other posts from Stack Overflow
or by michael
Published on 2010-03-30T00:05:29Z
Indexed on
2010/03/30
0:13 UTC
Read the original article
Hit count: 776
python
|syntax-error
This code works when I try it from a .py file, but fails in the command line interpreter and Idle.
>>> try:
... fsock = open("/bla")
... except IOError:
... print "Caught"
... print "continue"
File "<stdin>", line 5
print "continue"
^
SyntaxError: invalid syntax
I'm using python 2.6
© Stack Overflow or respective owner