Deal with locked exceptions elsewhere too

This commit is contained in:
karimpwnz 2021-01-02 04:46:21 +02:00
parent 0975e66228
commit 3b83c549ff

View file

@ -186,12 +186,14 @@ def set_keychain(journal_name, password):
if password is None: if password is None:
try: try:
keyring.delete_password("jrnl", journal_name) keyring.delete_password("jrnl", journal_name)
except keyring.errors.PasswordDeleteError: except (keyring.errors.KeyringLocked, keyring.errors.PasswordDeleteError):
pass pass
else: else:
try: try:
keyring.set_password("jrnl", journal_name, password) keyring.set_password("jrnl", journal_name, password)
except keyring.errors.NoKeyringError: except (keyring.errors.KeyringLocked):
pass
except (keyring.errors.NoKeyringError):
print( print(
"Keyring backend not found. Please install one of the supported backends by visiting: https://pypi.org/project/keyring/", "Keyring backend not found. Please install one of the supported backends by visiting: https://pypi.org/project/keyring/",
file=sys.stderr, file=sys.stderr,