Remote Debug
Enable PTVSD - Python Tools for Visual Studio debug server
This skill adds PTVSD - Python Tools for Visual Studio debug server to make it posible to
debug running skills.
It is made as a companion to the THEIA IDE skill to enable debugging from there. But if you use another IDE like VS Code you can use this skill to inject the debug adaptor in the
mycroft.skills service and attach to it on port 5678.
When you activate debugging by saying “Run debug adaptor” the skill will change Settings for padatious single_thread = true so skills service runs in single thread.
THEIA IDE (latest version) should already be setup so you just have to start debug from debug menu after starting remote debug adaptor.
When finish debugging say “End debug adaptor” and skill restore single_thread settings and the skill will restart mycroft.skills service
https://github.com/Microsoft/ptvsd
This skills requeue using the dev branch !
launch.json
To use the debug adaptor from THEIA IDE or VS Code make sure you use Python
remote attach setting in launch.json
{
"name": "Python: Remote Attach",
"type": "python",
"request": "attach",
"port": 5678,
"host": "localhost",
}
Examples
- Start (remote|ptvsd|) debug adaptor
- Enable (remote|ptvsd|) debug adaptor
- Run (remote|ptvsd|) debug adaptor
- Stop (remote|ptvsd|) debug adaptor
- Exit (remote|ptvsd|) debug adaptor
- End (remote|ptvsd|) debug adaptor
How to install Remote debug skill
use mycroft-msm to install the skill
mycroft-msm install https://github.com/andlo/remote-debug-skill.git
How to test Remote debug skill
- Start remote debug adaptor by saying “hey mycroft - run remote debug adaptor”
- in VS THEIA IDE or VS code (or maybe other IDE` start debug and atatch to remote
- edit the init.py in the mycroft-hello-world.mycrofta skill
- set breakpoint in line 46 `` self.speak_dialog(“how.are.you”)````
- say “hey mycroft - thanks” and see that code is paused and debuger is active
- step throu the code or stop debuging
- say “hey mycroft - end remote debug adaptor”
If it works as expected th debugger stops and and you can go throu code step by step and see values in variables etc. you can step in and out of functions
When debug adaptor is running you can se that ptvsd is running
andlo@DESKTOP-D9EUQU6:/opt/mycroft/skills/mycroft-hello-world.mycroftai$ ps ax |grep " -m mycroft.skills"
17025 ? Sl 5:36 python3 -m ptvsd --host 0.0.0.0 --port 5678 -m mycroft.skills
20565 pts/0 S 0:00 grep --color=auto -m mycroft.skills
when debugger isnt running you see
andlo@DESKTOP-D9EUQU6:/opt/mycroft/skills/mycroft-hello-world.mycroftai$ ps ax |grep " -m mycroft.skills"
20696 ? Rl 0:01 python3 -m mycroft.skills
20782 pts/0 S 0:00 grep --color=auto -m mycroft.skills
Feedback on this Skill and debugging with PTVSD can be done through Issues on the skills GitHub page or here in the forum or via Mycroft Chat.