Am 16.11.2011 19:39, schrieb Frederic Rentsch: >> py>import sys >> py>try: >> py> raise RuntimeError >> py> except: >> py> print sys.exc_info() >> py> >> (<type 'exceptions.RuntimeError'>, RuntimeError(), <traceback object >> at 0x0000000002371588>) > > Chris, Thanks very much! Great help!
How about using the excellent logging framework instead of rolling your own stuff? It can print the traceback, too. >>> import logging >>> logging.basicConfig() >>> log = logging.getLogger("mymodule") >>> try: ... raise ValueError("test") ... except Exception: ... log.exception("some message") ... ERROR:mymodule:some message Traceback (most recent call last): File "<stdin>", line 2, in <module> ValueError: test Christian -- http://mail.python.org/mailman/listinfo/python-list