Setting the exit status from sys.excepthook
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Mon Nov 21 03:12:46 EST 2016
I have script with an exception handler that takes care of writing the
traceback to syslog, and I set it as the global exceptionhook:
sys.excepthook = my_error_handler
When my script raises, my_error_handler is called, as expected, and the process
exits with status 1.
How can I change the exit status to another value, but only for exceptions
handled by my_error_handler?
--
Steven
299792.458 km/s — not just a good idea, it’s the law!
More information about the Python-list
mailing list