You can easily do that with the pdb package. Just use import pdb at the start of the script, and then run pdb.set_trace() wherever you'd like a breakpoint to be set. What will happen is that when you run the code, all of it will execute up until the breakpoint and then an interactive shell will appear where you can do more Python coding to see what will appear!
If this solves your problem, please consider upvoting and marking my answer as the accepted answer to close this question. If you have any more questions, I'll continue to answer them to the best of my ability.
Hey @r1200gs,
You can easily do that with the
pdb
package. Just useimport pdb
at the start of the script, and then runpdb.set_trace()
wherever you'd like a breakpoint to be set. What will happen is that when you run the code, all of it will execute up until the breakpoint and then an interactive shell will appear where you can do more Python coding to see what will appear!I made a simple repl for you to show off setting a breakpoint:
https://repl.it/@heyitsmarcus/test-python-debug
I hope this helps!
@heyitsmarcus Oh and here are a few commands you can use with
pdb
:c
continue executionn
step to the next line within the same functions
step to the next line in this function or a called functionq
quit the debugger/execution