I'm on Linux and expected it to work like pdb, gdb, i.e., press enter
to repeat the last command. I understand the debugger has a Variables
watch window.
Alt-p retrieves previous command matching what you have typed. Alt-n retrieves next. (These are Control-p, Control-n on the Mac) Return while cursor is on a previous command retrieves that command.
Starting Python Debugger To start debugging within the program just insert import pdb, pdb. set_trace() commands. Run your script normally, and execution will stop where we have introduced a breakpoint. So basically we are hard coding a breakpoint on a line below where we call set_trace().
Pressing the Enter key at the (Pdb) prompt will execute the previous command again. This is most useful after the s / n / r / unt commands to quickly step through execution line-by-line.
The Python debugger will automatically start over when it reaches the end of your program. Whenever you want to leave the pdb console, type the command quit or exit .
Ctrl-n/p - browse command line history
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With