Plugin questions (python script) and journal debug mode issue
-
Hi,
I have a .py script, that I would just run from the IDE when I was writing it (cant share it, sorry). Now I threw it into a .zip with a plugin.json, installed it. I see it on DWC, can start it, but nothing happens.
I have no DWC components, no clue how to have things show up there as of now, but since my .py script has output showing in terminal and some openCV windows starting, I expected the same to happen once I started the plugin in DWC.
In the journalctl I just see this, not very helpful.
system booted, all good
Jul 29 12:03:00 duet3 DuetControlServer[410]: [info] Starting macro file tpre0.g on channel Trigger Jul 29 12:03:00 duet3 DuetControlServer[410]: [info] Finished macro file tpre0.g Jul 29 12:03:00 duet3 DuetControlServer[410]: [info] Starting macro file tpost0.g on channel Trigger Jul 29 12:03:00 duet3 DuetControlServer[410]: [info] Finished macro file tpost0.g Jul 29 12:03:00 duet3 DuetControlServer[410]: [info] Finished macro file config.g Jul 29 12:08:58 duet3 DuetControlServer[410]: [info] System time has been changed
my plugin started through DWC, journal throws this error continuously
Jul 29 12:10:44 duet3 DuetControlServer[410]: [warn] IPC#22: Client with outdated protocol version connected (got 11, want 12) Jul 29 12:10:47 duet3 DuetControlServer[410]: [warn] IPC#23: Client with outdated protocol version connected (got 11, want 12) Jul 29 12:10:50 duet3 DuetControlServer[410]: [warn] IPC#24: Client with outdated protocol version connected (got 11, want 12) Jul 29 12:10:53 duet3 DuetControlServer[410]: [warn] IPC#25: Client with outdated protocol version connected (got 11, want 12) Jul 29 12:10:56 duet3 DuetControlServer[410]: [warn] IPC#26: Client with outdated protocol version connected (got 11, want 12) Jul 29 12:10:59 duet3 DuetControlServer[410]: [warn] IPC#27: Client with outdated protocol version connected (got 11, want 12) Jul 29 12:11:02 duet3 DuetControlServer[410]: [warn] IPC#28: Client with outdated protocol version connected (got 11, want 12) Jul 29 12:11:05 duet3 DuetControlServer[410]: [warn] IPC#29: Client with outdated protocol version connected (got 11, want 12) Jul 29 12:11:08 duet3 DuetControlServer[410]: [warn] IPC#30: Client with outdated protocol version connected (got 11, want 12)
My plugin stopped in DWC
Jul 29 12:11:11 duet3 DuetControlServer[410]: [error] IPC#32: Failed to find plugin permissions for pid #1296 Jul 29 12:11:11 duet3 DuetControlServer[410]: [warn] IPC#32: Terminating connection due to insufficient permissions
The permission part I don't get, they are defined in the plugin.json file:
(there is more than I need for sure){ "id": "My First Plugin", "name": "MyPlugin", "author": "Me", "version": "1.0.0", "license": "MIT", "homepage": "redacted", "dwcVersion": "3.4", "sbcDsfVersion": "3.4", "sbcRequired": true, "sbcExecutable": "my_script.py", "sbcExecutableArguments": null, "sbcOutputRedirected": false, "sbcPackageDependencies": [], "sbcPythonDependencies": [], "sbcPermissions": ["objectModelReadWrite","gpioAccess", "fileSystemAccess", "commandExecution", "launchProcesses"] }
I tried to stop DCS and restart in debug mode
sudo /opt/dsf/bin/DuetControlServer -l debug -r
but Im not sure what this is supposed to do, DWC does not reconnect and the terminal just continues this sort of output. I cant even stop DCS again anymore, starting after stop says another is still running, but DWC says its not started.... ugh. I have to restart everything to DWC be able to connect again.
[info] Settings loaded [info] Environment initialized [info] Connection to Duet established [info] IPC socket created at /run/dsf/dcs.sock [debug] Updated key limits [debug] Requesting update of key boards, seq 0 -> 363 [debug] Updated key boards [debug] Requesting update of key directories, seq 0 -> 0 [debug] Updated key directories [debug] Requesting update of key fans, seq 0 -> 8 [debug] Updated key fans [debug] Requesting update of key global, seq 0 -> 0 [debug] Updated key global [debug] Requesting update of key heat, seq 0 -> 12 [debug] Updated key heat [debug] Requesting update of key inputs, seq 0 -> 20 [debug] Updated key inputs [debug] Requesting update of key job, seq 0 -> 2
I dont know how to proceed figuring this out.
-
Python has a debugger , which is available as a module called pdb . It supports setting conditional breakpoints , stepping through the source code one line at a time, stack inspection, and more.
import pdb msg = "this is a test" pdb.set_trace() print(msg)
Insert pdb.set_trace() anywhere and it will function as a breakpoint . When you execute the script by python test.py, you will in the python debug mode.