I am trying to log the error that caused my process to shut down, but traceback.print_tb and traceback.print_exc don't seem to realize what the raised error is.
In other words, why does the following print 'None\n' instead of 'DivisionByZero .. etc ..'? (Edit: ..and how do I get access to the raised/handled error from within exit_fn?)
import traceback, atexit def exit_fn(): print 'exiting' if traceback.format_exc().startswith('None'): print 'why is this None?' atexit.register(exit_fn) x = 1/0