How do I print Python 2.5 Exception arguments?
Does python 2.5 allow you to pass exception arguments?
try: raise Exception("argument here")
except Exception: print Exception.args
I've had no luck with the above code - I know this is how you do it in Python 2.7 - i开发者_开发知识库s this not in Python 2.5?
You aren't actually raising the exception, just creating it. Once you fix that, you also need to refer to the instance that gets raised, not just the Exception class:
>>> try:
... raise Exception('foo', 23)
... except Exception, e:
... print e.args
...
('foo', 23)
精彩评论