From c3782c9468da0438650b9f06e8f316e36e4c58ed Mon Sep 17 00:00:00 2001 From: Konstantinos Karmas Date: Mon, 21 Jun 2021 15:40:18 +0200 Subject: [PATCH] Check for KeychainDenied Exception only on OSX CURA-8332 --- cura/OAuth2/KeyringAttribute.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cura/OAuth2/KeyringAttribute.py b/cura/OAuth2/KeyringAttribute.py index 8ade00bc03..3051e40eb8 100644 --- a/cura/OAuth2/KeyringAttribute.py +++ b/cura/OAuth2/KeyringAttribute.py @@ -40,13 +40,12 @@ class KeyringAttribute: self._store_secure = False Logger.logException("w", "No keyring backend present") return getattr(instance, self._name) - except KeychainDenied: - self._store_secure = False - Logger.logException("w", "Access to the keyring was denied.") - return getattr(instance, self._name) except Exception as e: self._store_secure = False - Logger.logException("w", f"Something went wrong while trying to retrieve the password from the Keyring. Exception: {e}") + exception_message = f"Something went wrong while trying to retrieve the password from the Keyring. Exception: {e}" + if Platform.isOSX() and hasattr(sys, "frozen") and type(e) == KeychainDenied: + exception_message = "Access to the keyring was denied." + Logger.logException("w", exception_message) return getattr(instance, self._name) else: return getattr(instance, self._name)