How do I set sys.excepthook to invoke pdb globally in python?

前端 未结 3 1877
你的背包
你的背包 2020-12-29 15:14

From Python docs:

sys.excepthook(type, value, traceback)

This function prints out a given traceback and exception to sy

3条回答
  •  爱一瞬间的悲伤
    2020-12-29 15:31

    Another option is to use ipython, which I consider a must-have tool for any python developer anyway. Instead of running your script from the shell, run it from ipython with %run. When an exception occurs, you can type %debug to debug it. (There's also an option to automatically debug any exception that occurs, but I forget what it is.)

提交回复
热议问题