Is it possible to automatically break into the debugger when a exception is thrown?

前端 未结 6 535
栀梦
栀梦 2021-02-07 06:00

If ones catches an exception outside of the function it is originally thrown, ones loses access to the local stack. As a result one cannot inspect the values of the variables th

6条回答
  •  情书的邮戳
    2021-02-07 06:32

    ipython supports this (http://ipython.org). from inside ipython, do

    %pdb on
    

    and from then on, it will automatically drop you inside the debugger whenever you get an exception.

    note that you'll (probably) quickly tire of this in general use... every time you mistype something and get a syntax error, you'll have to exit the debugger. but it's sometimes useful.

提交回复
热议问题