Here’s the way I debug plugins:
- Copy the Python code (usually in a
__init__.py
) to a new file in~/.pioreactor/plugins/
. Example:nano .pioreactor/plugins/spec.py
- So long as the python has
click
code at the bottom, something like:
you can run it manually with@click.command(name="spectrometer_reading") def click_spectrometer_reading() -> None: ...
pio run spectrometer_reading
. Python code in the~/.pioreactor/plugins
folder will overwrite any other installed plugins, so you don’t need to worry about existing plugins installed via the UI interferring. - I like to put lots of
print
orself.logger.debug
statements my code during debugging so I can see outputs while running. - When you’re happy, you should remove the plugin (or keep it to continue using it) with
rm ~/.pioreactor/plugins/spec.py
.