No python3 via command_line in Hass.io?

Does something special have to be done in Hass.io to enable running python scripts from a command_line sensor or switch? If I create a command_line switch that is supposed to execute the following command:

python3 /path/to/my/script.py

I get a “Command failed” error in the logs. If SSH to Hass.io and try to execute the same command, I get:

“-ash: python3: not found”

I’ve seen other threads that seem to imply that people are successfully doing what I’m trying to do here under Hass.io, but I can’t figure out what I’m missing. Any suggestions?

1 Like

I have the same issue. Any suggestions?

Could someone please answer this?

What are you trying to run? Have you tried the python script component or appdaemon?

I am trying to run a command_line sensor as a python script. Normally I am using bash, which is not a problem, but when I ssh to hassio, I have no “python” command.

you can run python scripts from hass.io like this

command line sensor

- platform: command_line
    name: Last Alexa
    command: 'python3 /config/alexa/alexa_wrapper.py {{ "-lastalexa" }}'

Shell command

alexa: 'python3 /config/alexa/alexa_wrapper.py "{{ params }}"'

Great - thanks a lot.