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

1

14

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...

Wadesworth answered 16/6, 2013 at 21:55 Comment(7)
I think i saw somewhere something about SQLite. Maybe once I install that it will start to work?Wadesworth
Looks like you've hit this bug or a related one within ipython.Logarithmic
Damn. 3 months and I can't even remember if this problem has been solved or not, I have not been messing about with my one python script that makes use of this. I feel like ipython will simply not remember anything if SQLite isn't configured, which would indicate this is a bug if it did remember stuff some of the time. I'll have to investigate this further later; my kickstart script is already set to pip install ipython and sqlite (and readline) automatically. @Logarithmic thanks for linking that, breadcrumbs are good to haveWadesworth
@StevenLu Do you have a way around this?Adieu
@Adieu No I have not looked into this anymore. pudb looks interesting and I might switch to that, if i ever go back to Python again :)Wadesworth
Possible duplicate of History across ipdb sessionsTravelled
Any updates one this? Has anyone submitted PR for this improvement?Endocardium
U
3

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

Unmarked answered 19/4, 2014 at 5:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.