Fix missing encoding with open() (#53593)

* Fix missing encoding with open()

* Fix tests

* Improve open - frontend
This commit is contained in:
Marc Mueller 2021-07-28 09:41:45 +02:00 committed by GitHub
parent 1c20eb3263
commit 10bfc78365
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 49 additions and 39 deletions

View file

@ -139,7 +139,7 @@ def execute_script(hass, name, data=None):
"""Execute a script."""
filename = f"{name}.py"
raise_if_invalid_filename(filename)
with open(hass.config.path(FOLDER, filename)) as fil:
with open(hass.config.path(FOLDER, filename), encoding="utf8") as fil:
source = fil.read()
execute(hass, filename, source, data)