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: 788

Filed under:
|

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

Related posts about python

Related posts about syntax-error