Trying to find how to execute ipdb (or pdb) commands such as disable
.
Calling the h
command on disable
says
disable bpnumber [bpnumber ...] Disables the breakpoints given as a space separated list of bp numbers.
So how whould I get those bp numbers? was looking through the list of commands and couldn't get any to display the bp numbers
[EDIT]
The break
, b
and info breakpoints
commands don't do anything, although in my module i clearly have 1 breakpoint set like this import pdb; pdb.set_trace( )
- same for ipdb
. Moreover info
is not defined.
The output of help
in pdb
:
Documented commands (type help ): ======================================== EOF bt cont enable jump pp run unt a c continue exit l q s until alias cl d h
list quit step up args clear debug help n
r tbreak w b commands disable ignore next restart u whatis break condition down j p
return unalias whereMiscellaneous help topics: ========================== exec pdb
Undocumented commands: ====================== retval rv
And for ipdb
:
Documented commands (type help ): ======================================== EOF bt cont enable jump pdef psource run unt a c
continue exit l pdoc q s until alias cl
d h list pfile quit step up args clear debug help n pinfo r tbreak w b
commands disable ignore next pinfo2 restart u whatis break condition down j p pp return unalias whereMiscellaneous help topics: ========================== exec pdb
Undocumented commands: ====================== retval rv
I have saved my module as pb3.py and am executing it within the command line like this
python -m pb3 The execution does indeed stop at the breakpoint, but within di pdb (ipdb) console, the commands indicated don't display anything - or display a NameError
If more info is needed, i will provide it.
Use the b command with no arguments. Without argument, list all breaks, including for each breakpoint, the number of times that breakpoint has been hit, the current ignore count, and the associated condition if any.
info break - list breakpoints. r - Runs the program until a breakpoint or error. c - Continues running the program until the next breakpoint or error. f - Runs until the current function is finished.
To remove all commands from a breakpoint, type commands and follow it immediately with end ; that is, give no commands. Specifying any command resuming execution (currently continue , step , next , return , jump , skip , and quit ) terminates the command list as if that command was immediately followed by end .
You can insert a breakpoint with the breakpoint() function at any position in your code . This is new in Python 3.7, and is equivalent to the older import pdb; pdb. set_trace() command. # my_script.py a = int(0.1) b = 3.0 c = a + b breakpoint() # a lot of more code here...
Use the break
command. Don't add any line numbers and it will list all instead of adding them.
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