making python 2.6 exception backward compatible

Posted by m2o on Stack Overflow See other posts from Stack Overflow or by m2o
Published on 2009-09-03T12:55:16Z Indexed on 2010/03/25 8:13 UTC
Read the original article Hit count: 539

Filed under:
|
|
|

I have the following python code:

 try:
      pr.update()
 except ConfigurationException as e:
      returnString=e.line+' '+e.errormsg

This works under python 2.6, but the "as e" syntax fails under previous versions. How can I resolved this? Or in other words, how do I catch user-defined exceptions (and use their instance variables) under python 2.6. Thank you!

© Stack Overflow or respective owner

Related posts about python

Related posts about exception