Debugging a PlatformIO Command
Answered
Hello.
I’m trying to chase down a possible bug in platformio-core which is written in Python. I would like to be able fire up the PyCharm debugger and step through the relevant code.
I’ve cloned the platformio-core repository, run tox, and opened the directory in PyCharm.
I have no idea how to actually debug it at this point.
Also, the IDE is complaining that it can’t find the click or semantic_version imports.
Cam someone point me to a relevant forum and/or documentation for working on and debugging platformio-core?
TIA,
D.
Please sign in to leave a comment.
Looks like the interpreter PyCharm uses for the project doesn't have platformio-core's dependencies installed. The tox virtualenvs under .tox/ are throwaway test envs, not the interpreter to develop against.
Make sure to Configure a new Python interpreter and install all the dependencies
In Run | Edit Configurations, add a Python config, set the target selector to "Module name" = platformio, put the command in "Parameters" (e.g. run -e <env>), and set "Working directory" to the PlatformIO project you're building (the one with platformio.ini).
Set breakpoints in the sources and Debug. Docs: Run/debug configurations
For platformio-core's own dev-setup questions, that's PlatformIO's project: https://community.platformio.org