errors and exception
alanwilter at gmail.com
Mon Aug 16 09:06:20 CEST 2010
I am using things like:
except Exception as inst:
with open("myfile.txt") as f:
for line in f:
Things that seems to be new in python 2.6 and higher, however reading
http://docs.python.org/tutorial/errors.html and this not clear when this new
My trouble is that I want to make something similar above compatible with
python 2.5, but when running python2.5 I got:
except Exception as msg:
SyntaxError: invalid syntax
If there's a way (e.g. from __future__ ..., inherited modified Exception
class, etc) that could give a solution to keep my code in python 2.6 syntax
as above but compatible with python 2.5, that would be appreciated.
Many thanks in advance,
Alan Wilter S. da Silva, D.Sc. - CCPN Research Associate
Department of Biochemistry, University of Cambridge.
80 Tennis Court Road, Cambridge CB2 1GA, UK.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list