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

Running Python Scripts with Imports using pyscript

$
0
0

Hello everyone - I am trying to run on my HA installation a Python script that is heavily based on Google’s Calendar API Example which requires a bunch of imports. According to the docs running this should be possible with pyscript and a requirements.txt, but I can’t find out how.

My HA installation is running on a Pi4, is fairly vanilla, mostly updated to latest. pyscript is installed from HACS with configuration steps in configuration.yaml done, the script, requirements.txt and the token.json file is located on HA /config/pyscript and I get this in the logs which shows what the problem is, as expected if the modules are not installed:

2022-10-02 11:47:27.585 ERROR (MainThread) [custom_components.pyscript.file.calendar] Exception in </config/pyscript/calendar.py> line 10:
from googleapiclient.discovery import build
^
ModuleNotFoundError: No module named ‘googleapiclient’

It seems that requirements.txt is not being read. It just has 3 lines like you’d expect -

google-api-python-client
google-auth-httplib2
google-auth-oauthlib

Can anyone help me out? I am proficient in Python but a relative novice in HA.

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 106468

Trending Articles



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