You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is tangential to #12 and #13 but not entirely the same.
Details:
QGIS LTR 3.34.5-Prizren
OSX: Sonoma 14.4.1
VSCode: Version: 1.88.0
VSCode Python Extension: v2024.4.0
VSCode Python Debugger Extension: v2024.4.0
The problems:
When I click the button in this plugin it pops open a completely new instance of QGIS... which is very weird. I never found out why that was happening.
I did see an error relating to cannot import name 'absolute_path' from 'pydevd_file_utils' ( but I found that it was a conflict with ptvsd and that removing ptvsd solved that issue.
It seems like debugpy needs to be configured with the python executable path (which is sirprisingly difficult to find because sys.executable gives you the /Applications/QGIS-LTR.app/Contents/MacOS/QGIS folder which is not helpful)
My workarounds:
Make sure debugpy is installed using /Applications/QGIS-LTR.app/Contents/MacOS/bin/pip3 install debugpy
uninstall ptvsd completely using /Applications/QGIS-LTR.app/Contents/MacOS/bin/pip3 uninstall ptvsd
Here's what I baked into my plugin to get it working again. I'm triggering the debugger on an environment variable called RS_DEBUG being set to True.
def_enable_debug(self):
debug_port=5678debug_host="localhost"DEBUG_ON=os.environ.get("RS_DEBUG", "False").lower() =="true"ifnotDEBUG_ON:
returnifself.debugpyisNone:
try:
importdebugpyself.debugpy=debugpyexcept:
passifself.debugpyisNone:
returnelse:
try:
python_path=os.path.join(Path(os.__file__).parents[2], 'bin', Path(os.__file__).parent.name)
# NOTICE THAT I NEED TO CONFIGURE IT HERE!!!!!debugpy.configure(python=python_path)
exceptExceptionase:
raiseemsgPort=f'"request": "attach", "Port": {debug_port}, "host": "{debug_host}"'ifself.debugpy.is_client_connected():
returnelse:
t_, new_port=self.debugpy.listen((debug_host, debug_port))
then using the following in my launch.json file inside vscode I was able to get a client connecting and breakpoints firing again.
This is tangential to #12 and #13 but not entirely the same.
Details:
The problems:
cannot import name 'absolute_path' from 'pydevd_file_utils' (
but I found that it was a conflict withptvsd
and that removingptvsd
solved that issue./Applications/QGIS-LTR.app/Contents/MacOS/QGIS
folder which is not helpful)My workarounds:
debugpy
is installed using/Applications/QGIS-LTR.app/Contents/MacOS/bin/pip3 install debugpy
ptvsd
completely using/Applications/QGIS-LTR.app/Contents/MacOS/bin/pip3 uninstall ptvsd
Here's what I baked into my plugin to get it working again. I'm triggering the debugger on an environment variable called
RS_DEBUG
being set toTrue
.then using the following in my
launch.json
file inside vscode I was able to get a client connecting and breakpoints firing again.The text was updated successfully, but these errors were encountered: