我喜欢通过检查在Python脚本错误:如何在验尸调试时退出ipdb?
$ python3 -m pdb my_script.py
这滴我到一个PDB提示从哪里可以c
继续执行,并且当它击中的错误,我可以检查变量,然后q
退出脚本执行以返回到我的shell。
我试着用IPython的调试器模块一样,因为它是更加丰富多彩:
$ python3 -m ipdb my_script.py
但是,我不能退出调试一旦我做了检查错误。使用q
quit命令只是不断重新执行脚本和验尸模式之间的切换是:
$ python3 -m ipdb my_script.py
ipdb> c
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
ipdb> Inspect some variables at this point
ipdb> q
Post mortem debugger finished. The my_script.py will be restarted
ipdb> q
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
ipdb> q
Post mortem debugger finished. The my_script.py will be restarted
ipdb> q
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
ipdb> q
Post mortem debugger finished. The my_script.py will be restarted
ipdb> q
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
如何退出这个调试?
不^ C或^ d不行?我偶尔会得到类似的东西,不得不^ C几次退出 – spruceb
@spruceb那也不管用! –
出现最坏的情况,^ Z,那么'杀人%1'应该停止它的 – spruceb