Python: command not found

Hi.

I have installed a hassio docker qemux86-64 on a Ubuntu machine.

When I run in the terminal ‘python /config/my_script.py’ it returns ‘python: command not found’.

I did search all folders manually and run ‘which python’ and ‘find * | grep python’ and none. It looks like I do not have python installed.

The question: how could I install or add python to my /usr/bin or something like this?

If you’re trying to run a Python script from either of the SSH addons, you can’t do that. If you want to run python scripts via HA, you can either using the python_script: integration here, use AppDaemon, or create a custom component.

Thank you, @rccoleman for your reply.
When I try to use the python_script I receive this notification:

Invalid config
The following integrations and platforms could not be set up:

  • python_script
    Please check your config.

What I am trying is pretty simple. See below.
I have a shopping list saved in the ‘.shopping_list.json’ file and I need to parse that and send me by a telegram notify.

config.yaml:

sensor:
  - platform: command_line
    name: shopping_list
    command: 'python3 /config/shopping_list.py'

telegram notification:

    action:
      - service: notify.telegram_to_me
        data_template:
          message: >
            Your Shopping List. {{ states('sensor.shopping_list.attributes.name') }}
            '{{states.sensor.lista_de_compras.state}}'
            {% for item in states.sensor.shopping_list.attributes.name %}
              - {{ item.name }}
            {%- endfor -%}

shopping_list.py

#!/usr/local/bin/python
# coding: utf8
import json

with open('/config/.shopping_list.json') as data_file:
    shoppingListData = json.load(data_file)

content = u"Lista de Compras:\n"
for entry in shoppingListData:
    if not entry['complete']:
        content += u"- %s\n" % entry['name']

content += u"\n"

print(content)

The problem: the notification never arrive.

If I remove the for loop from the message and change by a simple text the notification normally arrives to me.

I cannot understanding where is the wrong.

Edited this to:

    action:
      - service: notify.telegram_to_me
        data_template:
          message: >
            Your Shopping List:
            {{states.sensor.shopping_list.state}}

And I have another error on my code: the sensor: duplicated. The error while parsing the .json file occurred by that.