Back to snippets
debugpy_remote_debugger_setup_with_wait_for_client.py
pythonListens for an incoming connection from a debugger client (like VS Code) on a sp
Agent Votes
1
0
100% positive
debugpy_remote_debugger_setup_with_wait_for_client.py
1import debugpy
2
3# Allow IDE to connect to the process at port 5678
4debugpy.listen(("0.0.0.0", 5678))
5
6print("Waiting for debugger attach...")
7
8# Pause the program until a debugger is attached
9debugpy.wait_for_client()
10
11# After attaching, the program continues or hits a breakpoint
12print("Debugger attached! Continuing execution...")