is there any Plugin that allows creating buttons to execute python scripts?
The only Plugins I found are "Action Commands", GCode System Commands, Custom Control Editor.
However non of this seems to work.
I have a Python script that modifys the position of to servos and I would like to have buttons in my Control view to execute that script.
I am really not experienced with configuring octoprint and could not get this to work with actions or gcode.
You can add system commands to the system pull-down. You can add commands to the Control tab. You can create pseudo gcode commands with the Gcode Systems Commands plugin and combine these, say, with custom Control button(s).
Thank you for that I got it somewhat working, but unfortunately not really.
The Python script I wanted to execute does not work, so I made a really small one that actually does work.
However that doesn't really help me, do you know how to debug the plugins?
I currently used gcode system commands to set the script as gcode and execute it with a command button from custom control editor.
It's important when writing scripts to know who you are and where you are. In most cases, you are
pi but it's not as easy to know where you are (the process's current working directory). The best approach is to not think relatively with paths that assume too much; just include the entire path to every command you hope to execute.
Reviewing the scripts in the
~/scripts folder, you should see what I mean.
For example, note that I've given full paths to things here. Your next question might be, "but how do I know the path to aplay, for example?" The Linux
which command is helpful here:
Oh my god you are a hero
That was the problem.
I read / write to a file within my script and I just used a relativ path / only the script name because it is in the same folder but with full path my script is now working, thank you!