Python Debugger (pdb) is easy to use, simply put
import pdb; pdb.set_trace() in your
.py file and run it.
Florian Preinstorfer made a great cheatsheet for what to do once you’re inside the debugger.
In Jupyter Notebooks#
In jupyter notebooks you can start the debugger as above, but you can also use the
It works like this:
- Get an error in a cell
%debugin another cell to start the debugger the error point of last run cell
The vanilla python debugger is good, but it misses some basic features such as tab completion.
Luckily there is ipdb which is a seamless replacement.
pip install ipdb and set breakpoints with
import ipdb; ipdb.set_trace().