Laszlo Nagy <[EMAIL PROTECTED]> wrote: > >> >> 591 > ./cat.py cat.py >> File "./cat.py", line 6 >> with open(sys.argv[nn]) as f: >> ^ >> SyntaxError: invalid syntax >> 592 > >> >> This example came from http://docs.python.org/tut/node10.html down in >> section 8.7 >> >> Am I missing something? >> > Are you using python 2.5? The with statement is not available before 2.5. > and even in Python 2.5 it isn't available unless you enable it. Add the following line before the 'import sys' line:
from __future__ import with_statement -- http://mail.python.org/mailman/listinfo/python-list