3

I want to set breakpoints using pdb and then run the loop in the program until that breakpoint. and then after checking the values keep continuing (only stopping at that point) until the loop ends. how do i do it?

2 Answers 2

2

You can run your program into pdb from the command line by running

python -m pdb your_script.py

This will stop execution at line 1, now set breakpoint with b linenumber e.g. b 25. Now type run it will run the program until that break point.

Sign up to request clarification or add additional context in comments.

Comments

1

If you can modify the code, one way is to add this line where you want to break:

import pdb; pdb.set_trace()

3 Comments

yes i added it. but it stops at that point one time and then when i press c it doesnt stop again (in a loop)
I want to keep looping it and stopping it at a point in a loop to check the values
use 'n' for next and 'c' for continue, or browse the pdb documentation

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.