On 25/12/2009 19:27, Gary Herron wrote:
Dotan Barak wrote:

Recover the exception, and examine the tuple of args or the message string.
>>> try:
...         eval("my_number < 10", {"__builtins__":None}, {})
... except NameError,e:
...         print e.args
...         print e.message
...
("name 'my_number' is not defined",)
name 'my_number' is not defined

First of all, thank - I really appreciate your response.
:)

I must admit that i don't like the idea of parsing a string (if tomorrow the format of the message will change,
i will be in a deep trouble ...).

Is there is another way which doesn't involve string parsing?

Thanks
Dotan
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to