Как мне установить sys.excepthook для глобального вызова pdb в python?
Из документов Python:
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
Как я могу изменить это глобально, чтобы действие по умолчанию всегда вызывалоpdb
? Есть ли файл конфигурации, который я могу изменить? Я не хочу оборачивать свой код, чтобы сделать это.