Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 96123

Problem triggering pythons script via shell command

$
0
0

@luhu wrote:

I can’t get it working to trigger a custom python script with an command line parameter via a shell_command. I’m always getting errors like this, but I can’t find any help what it means:

2020-03-04 17:49:47 ERROR (MainThread) [homeassistant.components.shell_command] Error running command: `/bin/bash -c 'python3 /home/pi/home-assistant/python_scripts/script.py 1'`, return code: 2
NoneType: None

I’ve tried it on several different ways (I think it’s a problem about how to target the python binary) but neither of these are working:

my_script: '/usr/local/lib/python3.7 /home/pi/home-assistant/python_scripts/my_script.py 1'
my_script: '/usr/local/bin/python3 /home/pi/home-assistant/python_scripts/my_script.py 1'
my_script: '/usr/bin/python3 /home/pi/home-assistant/python_scripts/my_script.py 1'
my_script: '/usr/local/bin/python /home/pi/home-assistant/python_scripts/my_script.py 1'
my_script: '/usr/local/bin/python /home/pi/home-assistant/python_scripts/my_script.py 10'
my_script: /bin/bash -c 'python3 /home/pi/home-assistant/python_scripts/my_script.py 1'
my_script: /bin/bash -c '/usr/local/lib/python3.7 /home/pi/home-assistant/python_scripts/my_script.py 2'
my_script: /bin/bash -c '/usr/local/bin/python3 /home/pi/home-assistant/python_scripts/my_script.py 3'
my_script: /bin/bash -c '/usr/bin/python3 /home/pi/home-assistant/python_scripts/my_script.py 4'
my_script: /bin/bash -c '/usr/local/bin/python /home/pi/home-assistant/python_scripts/my_script.py 5'
my_script: /bin/bash -c '/usr/local/bin/python /home/pi/home-assistant/python_scripts/my_script.py 6'

I’m using the home assistant docker container. When I try to execute the script from within the container it is working properly. For example like this:

pi@raspberrypi:~ $ docker exec -it hass /bin/bash
bash-5.0# /usr/local/bin/python python_scripts/weight_tracking.py 9

All the topics I found here mentioned that the problem was to better target the python cli but I guess I’ve tried everythin I could… :smiley:

Any ideas on what I’m doing wrong?

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 96123

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>