Page 1 of 1

Shell path to python in Docker Domoticz

Posted: Monday 28 July 2025 2:16
by ajay100
Hi all, recently a custom script stopped working in Domoticz Version: 2025.1 (build 16739) running in Docker. It is run with the command: 'script://exec_hs110.sh kp1151 on'. The Domoticz log was showing the script was activated, but it wasn't turning the device on or off.

Code: Select all

#!/bin/sh
/usr/bin/python /opt/domoticz/userdata/scripts/python/hs110_domoticz.py -d $1 -c $2 > /dev/null 2>&1 &
To troubleshoot from the Domoticz shell in docker, I ran the following from the Linux command prompt:
docker exec -it domoticz sh
sh -xv userdata/scripts/exec_hs110.sh kp1151 off

This was just printing the contents of the script, but not showing any errors. So I ran the python command directly:
/usr/bin/python /opt/domoticz/userdata/scripts/python/hs110_domoticz.py -d kp1151 -c off

At last I got an error!
sh: /usr/bin/python: No such file or directory

I then tried this command, without the path to python:
python /opt/domoticz/userdata/scripts/python/hs110_domoticz.py -d kp1151 -c off
Success!

Is this now the correct way to use python from Docker Domoticz and would you like me to document this for https://wiki.domoticz.com/Scripting_in_ ... ts_scripts?

Cheers - Andrew

Re: Shell path to python in Docker Domoticz

Posted: Monday 28 July 2025 9:25
by waltervl
This is general linux knowledge. Although normally Python resides in /usr/bin/ it is not obligatory and depends on the linux distro.
Use the following command to find the correct path to python:

Code: Select all

which python