From fb5ac886860f0c755d2915c24f97a17f7dcc2366 Mon Sep 17 00:00:00 2001 From: ducoterra Date: Fri, 7 Mar 2025 11:40:26 -0500 Subject: [PATCH] add debugpy snippet to vscode --- .vscode/vscode.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.vscode/vscode.md b/.vscode/vscode.md index e7f529e..9b07c4b 100644 --- a/.vscode/vscode.md +++ b/.vscode/vscode.md @@ -1,6 +1,7 @@ # VSCODE Configuration - [VSCODE Configuration](#vscode-configuration) + - [Debugpy Snippet](#debugpy-snippet) - [Fix Paste (if ctrl+v not working)](#fix-paste-if-ctrlv-not-working) - [Shell](#shell) - [Fonts](#fonts) @@ -8,6 +9,24 @@ - [Extensions](#extensions) - [Continue](#continue) +## Debugpy Snippet + +Use this to add debugging to any project + +```python +# Listens on 5678 +# Only runs if ACTIVATE_DEBUGPY=true is set +if os.getenv("ACTIVATE_DEBUGPY", "").lower() == "true": + try: + import debugpy + debugpy.listen(("0.0.0.0", 5678)) + print("Waiting for client on 5678...") + debugpy.wait_for_client() + print("Client connected") + except Exception as e: + print("DEBUG ERROR: " + str(e)) +``` + ## Fix Paste (if ctrl+v not working) Add to user keyboard settings (json)