set breakpoint pyton 3.6
r1200gs (1)

How do i set a breakpoint in the debugger? (Python 3.6)

You are viewing a single comment. View All
heyitsmarcus (287)

Hey @r1200gs,

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!

I made a simple repl for you to show off setting a breakpoint:
https://repl.it/@heyitsmarcus/test-python-debug

I hope this helps!

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.

heyitsmarcus (287)

@heyitsmarcus Oh and here are a few commands you can use with pdb:

  • c continue execution
  • n step to the next line within the same function
  • s step to the next line in this function or a called function
  • q quit the debugger/execution