Reputation: 170320
I was trying to get the interactive ipython which can also make use of auto-complete by doing the following but somehow I see it starting ipdb instead and not being able to make use of auto-complete.
pip install ipython pyreadline
export PYTHONBREAKPOINT=IPython.core.debugger.set_trace
# add breakpoint() somewhere inside the code
python whatever.py
The result is that ipdb is started, and pressing TAB will not do any auto-completes.
ipdb>
In fact the outcome looks the same as doing export PYTHONBREAKPOINT=ipdb.set_trace
which is quite weird.
If I start ipython manually it works fine and auto-complete works.
What am I doing wrong?
Upvotes: 4
Views: 745
Reputation: 798
In short, use : export PYTHONBREAKPOINT='IPython.terminal.debugger.set_trace'
Tested on IPython v8.19.0
From the docstring of Ipython.core.debugger module we can read:
This is an extension to PDB which adds a number of new features. Note that there is also the
IPython.terminal.debugger
class which provides UI improvements.
core.debugger
doesn't seem to be officially deprecated though, I guess internally in ipython it has some uses.
There is also the ipdb package that is meant to improve the experience of using the Ipython debugger, but it is maintained independently from Ipython and I haven't tried it yet.
Upvotes: 1
Reputation: 912
What version of Python/IPython/IPDB do you have? Where are you running them?
It's hard to know without additional context, but I do know that even when fully functioning, hitting TAB
when the cursor is in the first position on the command line in either IPython or IPDB will indent, not tab complete, even if there are other characters present.
If you type dis
and then TAB
, you should see something like the following:
There are other possibilities. I've seen things get weird, for example, if one's TERM
is set to something simple or esoteric (see, e.g., TERM=ansi
or TERM=rxvt
), if one doesn't have a fully-functional terminal to begin with, if one redirects/messes with STDIN/STDOUT (or has other tools interacting with those; see, e.g., this issue where IPython/IPDB have weird interactions with python -m doctest
), etc.
I've also seen disparities between when PYTHONBREAKPOINT
is set to ipdb.sset_trace
or ipdb.set_trace
(tab completion works) and when it's set to IPython.core.debugger.set_trace
(behaves like a dumb terminal).
Upvotes: 1