RuntimeWarning: Ignoring unimportable $PYTHONBREAKPOINT

Viewed 611

I have a breakpoint in my script, but when the script hits the breakpoint, it outputs:

RuntimeWarning: Ignoring unimportable $PYTHONBREAKPOINT

Is this something that the package I'm using is stopping me from doing?

3 Answers

This typically means that ipdb hasn't been installed if that's what you're using for the breakpoint.

Just run:

pip install ipdb
export PYTHONBREAKPOINT=ipdb.set_trace

In case you run into this problem but also have ipython installed, you can make use of the ipdb that comes preinstalled with ipython in the IPython.terminal.debugger module. (I had a potentially specific use case where I was using an anaconda environment that didn't have ipdb installed, but did have ipython, and I was worried about messing around with it by installing ipdb.)

Specifically, you can set

export PYTHONBREAKPOINT=IPython.terminal.debugger.set_trace

before running your script using python -m pdb myscript.py.

On my searches, I started with another ipdb debugger present in IPython.core.debugger (note that this one is core and not terminal). However, according to my own use and this thread, that version is now 'plainer' and doesn't include fancy things like autocompletion. (I'm actually unclear on how the 'plain' version of ipdb differs from pdb.)

(A side note: I also found that the PYTHONBREAKPOINT variable affects how breakpoint() calls work even if a script is called using ipython. Which is to say, if you run a script with a breakpoint() using ipython with pdb on, when you hit that line you will fall into the debugger set by PYTHONBREAKPOINT, rather than ipython's built in ipdb.)

try using pip install ipdb and then export PYTHONBREAKPOINT=ipdb.set_trace hope it works for you

Related