From c60f475b30bfba6c38d6825ee401a8ff247847c4 Mon Sep 17 00:00:00 2001 From: firstof9 Date: Sat, 13 Feb 2021 10:59:43 -0700 Subject: [PATCH 1/2] Create missing directories as needed * Related to #362 --- custom_components/mail_and_packages/helpers.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/custom_components/mail_and_packages/helpers.py b/custom_components/mail_and_packages/helpers.py index 08337f5f..4a0883ec 100644 --- a/custom_components/mail_and_packages/helpers.py +++ b/custom_components/mail_and_packages/helpers.py @@ -115,6 +115,17 @@ def image_file_name(hass: Any, config: Any) -> str: image_name = None path = f"{hass.config.path()}/{config.get(const.CONF_PATH)}" mail_none = f"{os.path.dirname(__file__)}/mail_none.gif" + + # Path check + path_check = os.path.exists(path) + if not path_check: + try: + os.makedirs(path) + except OSError as err: + _LOGGER.error("Problem creating: %s, error returned: %s", path, err) + return "mail_none.gif" + + # SHA1 file hash check try: sha1 = hash_file(mail_none) except OSError as err: From bedf63906c112edd0cd0235111524d2040d0bc5f Mon Sep 17 00:00:00 2001 From: firstof9 Date: Sat, 13 Feb 2021 11:26:35 -0700 Subject: [PATCH 2/2] Pin requirement versions in manifest --- custom_components/mail_and_packages/manifest.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/mail_and_packages/manifest.json b/custom_components/mail_and_packages/manifest.json index 0470925f..510afea1 100644 --- a/custom_components/mail_and_packages/manifest.json +++ b/custom_components/mail_and_packages/manifest.json @@ -10,8 +10,8 @@ ], "config_flow": true, "requirements": [ - "imageio", - "python-resize-image" + "imageio>=2.9.0", + "python-resize-image>=1.1.19" ], "version": "0.0.0" } \ No newline at end of file