ipython ipdb, when invoked via ipdb.set_trace(), does not remember the command history while debugging

不打扰是莪最后的温柔 提交于 2019-12-12 08:21:38

问题


iPython does remember the command history if I run ipython normally, e.g. to mess around testing basic things in the repl, but I would like to be able to pull up the debugging commands from the previous debug session, and I am doing my debugging by simply running my program as normal, where the program contains

import ipdb
def info(type, value, info):
    import traceback
    traceback.print_exception(type, value, info)
    ipdb.pm()

import sys
sys.excepthook = info
trace = ipdb.set_trace

Which is to set it up so I can write trace() anywhere in my program to start debugging there when I run the program, or for it to automatically start postmortem debugging when it dies on its own.

Python with iPython has been leaps and bounds beyond other languages when it comes to quick code/test iterations and I'm just so close to nirvana at this point...


回答1:


I use pudb instead. It enables getting to a real ipython shell from the debugger and all the commands there are saved



来源:https://stackoverflow.com/questions/17138106/ipython-ipdb-when-invoked-via-ipdb-set-trace-does-not-remember-the-command-h

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!