I\'m using jupyter (or Ipython) notebook with firefox, and want to debug some python code in the cell. I am using \'import ipdb; ipdb.set_trace()\' as kind of breakpoint, fo
If using Jupyter Notebook begin your cell with magic command "%%debug". Then a ipdb line will be shown at the bottom of the cell which will help you navigate through the debugging session. Following commands should get you started:
n- execute current line and go to next line.
c- continue execution until next break point.
Make sure you restart the kernel each time you decide on debugging, so that all variables are freshly assigned.You can check the value of each variable through the ipdb line and you will see that the variable is undefined until you execute the line that assigns a value to that variable.
%%debug
import pdb
from pdb import set_trace as bp
def function_xyz():
print('before breakpoint')
bp() # This is a breakpoint.
print('after breakpoint')