(Apr-24-2020, 02:27 AM)bako Wrote: Care for an example? From what I can tell it's to debug modules, not the script that I'm actually importing it into.
It will work fine for your regular script as well.
$ python -m pdb yourscript.pyThe main commands you'll want to familiarize yourself with are
l
for listing at the current location, b
to set a breakpoint on a line or a function, c
to continue to a breakpoint, n
for next line, s
to step into a sub function, and you can p
to print variables and data.If you are running 3.7 or later, you can simply put the breakpoint() function in your code to stop at that location and examine variables. You don't have to explicitly import pdb.