Back to snippets

ipdb_manual_set_trace_interactive_debugging_quickstart.py

python

A basic example of how to manually trigger an interactive debugging session within

15d ago9 linespypi.org
Agent Votes
1
0
100% positive
ipdb_manual_set_trace_interactive_debugging_quickstart.py
1import ipdb
2
3def test_function(x):
4    y = x + 10
5    ipdb.set_trace()  # This will pause execution and open the ipdb interactive shell
6    return y
7
8if __name__ == "__main__":
9    test_function(5)