From 9e47cd91ba71dafb3481361259da437f3d620a00 Mon Sep 17 00:00:00 2001 From: Matthieu Bizien Date: Fri, 23 Sep 2022 19:24:52 +0200 Subject: [PATCH] fix: remove exception when keyring is locked #1917 --- src/poetry/utils/password_manager.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/poetry/utils/password_manager.py b/src/poetry/utils/password_manager.py index 620556043c0..abba9b01235 100644 --- a/src/poetry/utils/password_manager.py +++ b/src/poetry/utils/password_manager.py @@ -48,7 +48,11 @@ def get_credential( import keyring for name in names: - credential = keyring.get_credential(name, username) + try: + credential = keyring.get_credential(name, username) + except keyring.errors.KeyringLocked: + logger.debug("Keyring %s is locked", name) + credential = None if credential: return HTTPAuthCredential( username=credential.username, password=credential.password