Posts tagged with: breakpoint

Using IPython (ipdb) for debugging

This is one of the things I always need but I forget. So here is a piece of mind to check back.

pip install ipython 
pip install ipdb
export PYTHONBREAKPOINT=ipdb.set_trace  # this is to use ipdb by default

When you run your code with a breakpoint, you get an IPython shell for debugging. So you can use all the perks like autocomplete, magic functions, etc.

print("this is an example")
breakpoint()
print("this is the end")
Share