PTVSD - Remote debugger support for Visual Studio Code and Visual Studio - tripkip - 2019-11-18
Home: https://github.com/microsoft/ptvsd/
Current status: I can't get it working (see error log below) and would like to ask all savy people to jump in, test and help us get this working.
- Install the script.module.ptvsd add-on:
- Setup your add-on for remote debugging:
- Require script.module.ptvsd
- Insert temporary code to attach the debugger
python:
import ptvsd
ptvsd.enable_attach()
ptvsd.wait_for_attach()
- Attach your debugger: run debug in VS Code and attach to Kodi host and ptvsd port which is 5678 by default
I am running this on Kodi 18.4 on a macOS Catalina host.
V4 error
Code:
2019-11-18 22:44:08.139 T:123145560268800 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.AttributeError'>
Error Contents: 'module' object has no attribute 'timeout'
Traceback (most recent call last):
File "/Users/pieter/Library/Application Support/Kodi/addons/plugin.video.yelo/main.py", line 2, in <module>
from resources.lib import plugin
File "/Users/pieter/Library/Application Support/Kodi/addons/plugin.video.yelo/resources/lib/plugin.py", line 1, in <module>
import routing
File "/Users/pieter/Library/Application Support/Kodi/addons/script.module.routing/lib/routing.py", line 27, in <module>
from urllib import urlencode
File "/Users/Shared/jenkins/workspace/OSX-64_Leia/tools/depends/xbmc-depends/macosx10.13_x86_64-target-release/lib/python2.7/urllib.py", line 26, in <module>
File "/Users/pieter/Library/Application Support/Kodi/addons/script.module.ptvsd/ptvsd/socket.py", line 64, in <module>
class TimeoutError(socket.timeout):
AttributeError: 'module' object has no attribute 'timeout'
-->End of Python script error report<--
V5 error
Code:
2019-11-18 22:06:30.831 T:123145355501568 ERROR: -------------------------------------------------------------------------------
2019-11-18 22:06:30.831 T:123145355501568 ERROR: pydev debugger: CRITICAL WARNING: This version of python seems to be incorrectly compiled (internal generated filenames are not absolute)
2019-11-18 22:06:30.831 T:123145355501568 ERROR: pydev debugger: The debugger may still function, but it will work slower and may miss breakpoints.
2019-11-18 22:06:30.831 T:123145355501568 ERROR: pydev debugger: Related bug: http://bugs.python.org/issue1666807
2019-11-18 22:06:30.831 T:123145355501568 ERROR: -------------------------------------------------------------------------------
2019-11-18 22:06:33.852 T:123145355501568 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.ImportError'>
Error Contents: No module named _multiprocessing
Traceback (most recent call last):
File "/Users/pieter/Library/Application Support/Kodi/addons/plugin.video.yelo/main.py", line 2, in <module>
from resources.lib import plugin
File "/Users/pieter/Library/Application Support/Kodi/addons/plugin.video.yelo/resources/lib/plugin.py", line 9, in <module>
from resources.lib.yelo import yelo
File "/Users/pieter/Library/Application Support/Kodi/addons/plugin.video.yelo/resources/lib/yelo/yelo.py", line 14, in <module>
ptvsd.enable_attach("")
File "/Users/pieter/Library/Application Support/Kodi/addons/script.module.ptvsd/lib/ptvsd/__init__.py", line 81, in enable_attach
return api.enable_attach(address, log_dir)
File "/Users/pieter/Library/Application Support/Kodi/addons/script.module.ptvsd/lib/ptvsd/server/api.py", line 44, in debug
log.describe_environment("ptvsd.server debug start environment:")
File "/Users/pieter/Library/Application Support/Kodi/addons/script.module.ptvsd/lib/ptvsd/common/log.py", line 276, in describe_environment
import multiprocessing
File "/Users/Shared/jenkins/workspace/OSX-64_Leia/tools/depends/xbmc-depends/macosx10.13_x86_64-target-release/lib/python2.7/multiprocessing/__init__.py", line 84, in <module>
ImportError: No module named _multiprocessing
-->End of Python script error report<--
RE: PTVSD - Remote debugger support for Visual Studio Code and Visual Studio - Cyber1000 - 2020-01-11
Did you find a running solution? I'm trying to get this running in a virtualbox (ubuntu 18.04) connected from vscode on host (win 10)
RE: PTVSD - Remote debugger support for Visual Studio Code and Visual Studio - Cyber1000 - 2020-01-12
Ok I found a working solution with the link you posted (with v5), I'll write here tomorrow, perhaps it helps someone in the future.
RE: PTVSD - Remote debugger support for Visual Studio Code and Visual Studio - Cyber1000 - 2020-01-15
Here are my steps (similar to yours):- checking out v5 version of https://github.com/piejanssens/repo-scripts.git
- copying into kodi addons and enabling it
- To my own addon I added a requires like this
xml: <import addon="script.module.ptvsd" version="5.0.0"/> , the syntax must be less or equal to the version the ptvsd-addon has
- In my py-file I wanted to debug I added:
python: import ptvsd ptvsd.enable
attach(address=('127.0.0.1', 5678))
ptvsd.wait_for_attach()
- Right now there is a bug in ptvsd, where ptvsd assumes a wrong version of itself (server-client)
Adding Option 1 of the following to my launch.json solved this: https://github.com/microsoft/ptvsd/issues/1854#issuecomment-553235992
- Now I was able to debug. Happy coding
As said it looks quite similar, perhaps there where problems at the time you wrote this, which are fixed by now.
|