Ed Jensen wrote:
> I'm using:
>
> Python 2.3.2 (#1, Oct 17 2003, 19:06:15) [C] on sunos5
>
>
> And I'm trying to execute:
>
> #! /usr/bin/env python
>
> try:
> f = file('test.txt', 'r')
> except IOError:
> print 'except'
> else:
> print 'else'
> finally:
> print 'finally'
>
>
> And the results are:
>
> File "./test.py", line 9
> finally:
> ^
> SyntaxError: invalid syntax
>
>
> What am I doing wrong?
You need Python 2.5 for that to work. In older Python versions you have to
nest try...except...else and try...finally.
Peter
--
http://mail.python.org/mailman/listinfo/python-list