Page 1 of 1

can't launch apython script from sh from blocky

Posted: Tuesday 05 January 2021 22:45
by paralight
Hi!


I thought I could find the solution but I 'm stuck on a blocky script or I want to launch a script sh .. a simple script sh which launches a python script, here in image the script:

Image

then the sh script:

Code: Select all

 #! / bin / sh

/usr/bin/python3/home/pi/domoticz/scripts/turnOnChambreEliza.py > /dev/null 2> & 1 &
exit 0
well the python script is not worth it, or the start:

Code: Select all


#!/usr/bin/env python3

asyncio import
import os
.........
the command /home/pi/domoticz/scripts/turnOnChambreEliza.sh works perfectly in a terminal and I have no errors in the domoticz logs ..

Image

the two scripts (sh and py) are in / home / pi / domoticz / scripts /
the rights are in 777 on the 2 files
-rwxrwxrwx 1 pi pi 1748 Jan 5 21:21 turnOnChambreEliza.py
-rwxrwxrwx 1 ft ft 102 Jan 5 21:38 turnOnRoomEliza.sh
an idea please? I 'm stuck with it and the only solution I see is a hack to go through an http request and launch python from a web server .. or ... some will tell me to pass everything on lua. .. but a little lazy. .

thank you

Re: can't launch apython script from sh from blocky

Posted: Wednesday 06 January 2021 13:56
by erem
you state
>>the command /home/pi/domoticz/scripts/turnOnChambreEliza.sh works perfectly in a terminal and I have no errors in the domoticz logs ..

what user runs that command.

and what user runs domoticz.

try running the command as the user tha runs domoticz to see if it still works

Re: can't launch apython script from sh from blocky

Posted: Wednesday 06 January 2021 23:50
by paralight
hi Rob
and thank you very much for your answer
you're right.
actually i was running command as "pi" user on my raspberry and domoticz is running as root
so actually there was an error when I run command as root, a python package was missing , this command:
"sudo pip3 install meross_iot" solves my problem, because domticz use root user.. (and I had installing package meross_iot as pi user.. )

thank again
regards,