Start the python debugger at any line

Python includes a built in debugger pdb, which is very helpful if you want to try to figure out problems. One way to start the debugger is by putting -m pdb when you call the python script. However you then have to set up the break-point in terms of filename, lineno.

anywhere in your python code, then run your script as normal and it will automatically launch the debugger when it gets to that line:

import pdb ; pdb.set_trace()

This entry is tagged: