0

I'm new to Python, but have experience with VSCode. I'm trying to debug a Python plugin running on a PyGTK-based application using VSCode, but I suspect my configuration is incorrect.

I can attach the debugger to the application and hit breakpoints in the plugin's code, but it's out of sync. It doesn't step on the correct line of the source code and the error messages report the wrong line numbers.

Pylance also complains about missing libraries belonging to the application. While my environment is aware of the standard python modules, it is unaware of the application's internal one. I'm not sure how I would go about resolving it. I did create a pyvenv.cfg in VSCode:

home = /usr/local/opt/python@3.10/bin
include-system-site-packages = false
version = 3.10.8

Here's the Python info I executed from the App's Python REPL window:

>>> import sys
>>> print (sys.version)
3.10.2 (main, Sep  4 2022, 13:22:00) [Clang 13.1.6 (clang-1316.0.21.2.5)]
>>> print (sys.version_info)
sys.version_info(major=3, minor=10, micro=2, releaselevel='final', serial=0)
 print(sys.executable)
/Users/phalen/Applications/GNATStudio.app/Contents/MacOS/gnatstudio

My code isn't using the same interpreter, nor the same version. How do I resolve these issues?

ATL_DEV
  • 9,256
  • 11
  • 60
  • 102
  • Have you tried shortcuts `Ctrl+Shift+P` and search for `Python: Select Interpreter`? – MingJie-MSFT Dec 05 '22 at 01:50
  • Yes. I selected the host interpreter's path and it didn't like it. – ATL_DEV Dec 05 '22 at 02:37
  • I have two questions. 1 Can it find the package normally without using debug? 2. Can you add "python" in the launch.json file to specify the interpreter path? – MingJie-MSFT Dec 05 '22 at 02:43
  • I found out the reason vscode rejected it was because there wasn't a bin folder or python executable. The python the application is using is some kind of embedded version perhaps a shared library. It does have a python folder full of python scripts. Is there a way to add it to the python path var? – ATL_DEV Dec 05 '22 at 02:54
  • You can try `sys.path.append()` – MingJie-MSFT Dec 05 '22 at 03:12
  • I am getting this error: pydev debugger: unable to find translation for:vscode/extensions/ms-python.python-2022.18.2/pythonFiles/lib/python/debugpy/server/cli.py" (please revise your path mappings). – ATL_DEV Dec 05 '22 at 03:21

0 Answers0