How do I set sys.excepthook to invoke pdb globally in python?
Posted
by saffsd
on Stack Overflow
See other posts from Stack Overflow
or by saffsd
Published on 2009-08-06T07:15:46Z
Indexed on
2010/04/14
0:23 UTC
Read the original article
Hit count: 270
From Python docs:
sys.excepthook(type, value, traceback)¶This function prints out a given traceback and exception to sys.stderr. When an exception is raised and uncaught, the interpreter calls sys.excepthook with three arguments, the exception class, exception instance, and a traceback object. In an interactive session this happens just before control is returned to the prompt; in a Python program this happens just before the program exits. The handling of such top-level exceptions can be customized by assigning another three-argument function to sys.excepthook.
http://docs.python.org/library/sys.html
How do I modify this globally so the default action is to always invoke pdb? Is there a configuration file I can change? I don't want to wrap my code to do this.
© Stack Overflow or respective owner