I have a python script in /config/python_scripts/convert_to_json.py. I am testing the script by calling it under services i.e. service: python_script.convert_to_json. The two lines of my script are
import json
entity_ids = data.get("entity_id")
I see an error in the log
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/python_script/__init__.py", line 224, in execute
exec(compiled.code, restricted_globals) # noqa: S102
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "convert_to_json.py", line 1, in <module>
ImportError: __import__ not found
I don’t understand why. I searched and I see a lot of scripts that begin this way.
Thanks
Kurt