Open BoergiM87 opened 3 years ago
I am doing pretty much the same, except with python scripts and not having any issues...
Does you shell script execute when called directly from a terminal ? It also depends what your script contains...
I have test it to with a python script, but the same problem. Octoprint hangs completely and you have to restart the Pi.
Over the terminal i can execute the script with no errors.
This is the script:
import requests
url = 'XY'
headers = {
'Accept': 'application/json, text/javascript, */*; q=0.01',
'X-Requested-With': 'XMLHttpRequest',
'Content-Type': 'application/json; charset=UTF-8'
}
payload = ''
r = requests.post(url, data=payload, headers=headers)
print r
I was having this issue with octoprint hanging. Now I recreated everything and it doesn't hang, but also doesn't work... :/
I create a script with a just an echo 'test'
and it doesn't output anything....
@luizbgomide Shell script is only supposed to run the script, not to output anything that it spits out. https://github.com/vitormhenrique/OctoPrint-Enclosure/blob/master/octoprint_enclosure/__init__.py#L534
@BoergiM87 that is a PYTHON script, and this is not supposed to run a PYTHON script, only a SHELL script. Unless you call it with a python before it will never work.
@vitormhenrique my issue was that it doesn't seem like the script was actually running. In the end I removed all my settings and recreated the call to the scripts and it worked... I'm really not sure of why it didn't work before.
I'm using that to trigger PSU Control, only because it has a dedicated icon on Printoid, otherwise it could have managed it entirely in your plugin...
@vitormhenrique my issue was that it doesn't seem like the script was actually running. In the end I removed all my settings and recreated the call to the scripts and it worked... I'm really not sure of why it didn't work before.
I'm using that to trigger PSU Control, only because it has a dedicated icon on Printoid, otherwise it could have managed it entirely in your plugin...
@luizbgomide Did you ever figure out what the problem was besides removing your settings and re-creating them? I'm having the same issue trying to call:
curl -s -H "Content-Type: application/json" -H "X-Api-Key: YOUR_API_KEY" -X POST -d '{ "command":"turnPSUOn" }' http://YOUR_OCTOPRINT_SERVER/api/plugin/psucontrol
I created a script to touch a file which works, but doesn't like the above line.
@DiP-ER no, no idea.
Describe the bug Hi, if I create an output "shell script" with the path to the script and execute it, the whole webinterface does not react anymore and I have to restart the PI.
To Reproduce Steps to reproduce the behavior:
Additional context