I am running a code with pdb
python -m pdb somecode.py 3
I would like to pass a file on the command line, where I can specify the breakpoints. The code selects some dataset thought the passed parameter -- in this case 3
. I am running this script on a cluster. I know it is possible setting up .pdbrc
, but I have some jobs running this code on different datasets (on those datasets the code works properly) and I don't want to interfere with that -- actually the other jobs are on the cluster queue and they could start anytime.
EDIT: would it be possible to set breakpoints, continue to next breakpoint, set a variable, continue to next breakpoint?
You can use
-c
option (python 3 only). Docs quote (https://docs.python.org/3/library/pdb.html):to set a breakpoint on line 3 (and go to it - second '-c' need for this):
about sequence of instructions: yes, multiple -c options = multiple instructions. But it seems that with this method you cant set variables:
-c "aaa=1"
not works. You can try to usealias
command to predefine some vars through command line args - additional manual command in pdb and all needed will be set: