From 2aa982d407f29dad831af5af0a1d6ac7f58e2def Mon Sep 17 00:00:00 2001 From: Jon Michael Aanes Date: Tue, 26 Nov 2024 23:01:08 +0100 Subject: [PATCH] Also handle permission error --- secret_loader/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/secret_loader/__init__.py b/secret_loader/__init__.py index 12f05f8..7caa285 100644 --- a/secret_loader/__init__.py +++ b/secret_loader/__init__.py @@ -184,7 +184,7 @@ class SecretLoader: try: with open(filepath) as f: return f.read().strip() - except FileNotFoundError: + except (FileNotFoundError, PermissionError): return None def _load_or_none_env(self, secret_name) -> str | None: @@ -210,7 +210,7 @@ class SecretLoader: check=False, shell=False, ) - except FileNotFoundError: + except (FileNotFoundError, PermissionError): return None return self._convert_pass_process_result_to_password(