From ae7466ccfefc60e0de72ad792ca8a8923ced67da Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Thu, 2 Aug 2018 21:48:50 +0200 Subject: [PATCH] Fix UnicodeDecodeError with read json file (#613) * Update json.py * Update data.py --- hassio/addons/data.py | 2 +- hassio/utils/json.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hassio/addons/data.py b/hassio/addons/data.py index bafc2db88..185f2f33a 100644 --- a/hassio/addons/data.py +++ b/hassio/addons/data.py @@ -80,7 +80,7 @@ class AddonsData(JsonConfig, CoreSysAttributes): read_json_file(repository_file) ) - except (OSError, json.JSONDecodeError): + except (OSError, json.JSONDecodeError, UnicodeDecodeError): _LOGGER.warning("Can't read repository information from %s", repository_file) return diff --git a/hassio/utils/json.py b/hassio/utils/json.py index 93eb482c2..373ff60cd 100644 --- a/hassio/utils/json.py +++ b/hassio/utils/json.py @@ -45,7 +45,7 @@ class JsonConfig: if self._file.is_file(): try: self._data = read_json_file(self._file) - except (OSError, json.JSONDecodeError): + except (OSError, json.JSONDecodeError, UnicodeDecodeError): _LOGGER.warning("Can't read %s", self._file) self._data = {}