Is it possible to print different levels to different streams using the logging module?

2010-01-16 Thread Dotan Barak
ce, and for the stream that i choose. (I failed to find a "maximum level" for the handlers in the logging module). Thanks in advanced Dotan Barak -- http://mail.python.org/mailman/listinfo/python-list

Re: Is it possible to get the erroneous variable when getting a NameError exception?

2009-12-26 Thread Dotan Barak
A simple expression is enough to write to files, for example. Try this expression in Python 3.0: [x for x in ().__class__.__base__.__subclasses__() if x.__name__ == '_FileIO'][0]('hello.txt', 'w').write('Hello, World!') To explain, "().__class__.__base__.__subclasses__()" gives you a li

Re: Is it possible to get the erroneous variable when getting a NameError exception?

2009-12-25 Thread Dotan Barak
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 ...

Is it possible to get the erroneous variable when getting a NameError exception?

2009-12-25 Thread Dotan Barak
Hi. I'm trying to evaluate a string and getting a NameError (it is expected, since the variable my_number wasn't provided in the "locals" dictionary). <--snip start--> >>> eval("my_number < 10", {"__builtins__":None}, {}) Traceback (most recent call last): File "", line 1, in ? File "", li