From f1f28d72eb0221581b51c7dd1e4d0435db991eb8 Mon Sep 17 00:00:00 2001 From: Ko Nagase Date: Sun, 28 Apr 2024 00:36:39 +0900 Subject: [PATCH] Configure debugpy python path --- __init__.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/__init__.py b/__init__.py index 07f6ac4..b4c0bb2 100644 --- a/__init__.py +++ b/__init__.py @@ -48,6 +48,7 @@ def __init__(self, iface): import debugpy self.debugpy = debugpy + self.debugpy.configure(python=get_qgis_python_path()) except: pass self.port = 5678 @@ -160,3 +161,13 @@ def run(self, checked): self.debugpy.wait_for_client() exec(open(filename).read()) + +def get_qgis_python_path(): + if sys.platform.startswith("linux"): + return sys.executable + pythonExec = os.path.dirname(sys.executable) + if sys.platform == "win32": + pythonExec += "\\python3" + else: + pythonExec += "/bin/python3" + return pythonExec