For debugging my python code, I use the ipdb
library, and use the set_trace()
command to place a break point. Once the code reaches there, I get an interactive shell with ipdb>
prompt, that I can explore local variables with tab autocompletion.
In IPython (Jupyter) notebook, however, ipdb.set_trace()
does not work. As suggested by this post:
using ipdb to debug python code in one cell (jupyter or Ipython)
I use the following alternative for interactive debugging:
from IPython.core.debugger import Tracer
Tracer()() #this one triggers the debugger
This gives me the ipdb>
prompt, but the tab autocomplete is not available. Is there anyway to enable auto-complete for interactive debugging using ipython notebook? This is extremely useful, specially when you have a lot of variables with long names.