From 4f6d25c4acc05179eba7fd0724efe666fbde355e Mon Sep 17 00:00:00 2001 From: "maruel@chromium.org" Date: Tue, 23 Aug 2011 20:34:11 +0000 Subject: [PATCH] Update upload.py from rietveld @ 7696eca367d2. --- Trap failure to get password from keyring It happens when using upload.py from a ssh session without a X session but gnomekeyring is used. R=dpranke@chromium.org BUG= TEST= Review URL: http://codereview.chromium.org/7715013 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@97909 0039d316-1c4b-4281-b951-d872f2087c98 --- third_party/upload.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/third_party/upload.py b/third_party/upload.py index 53c2c9365..8b7268a7c 100755 --- a/third_party/upload.py +++ b/third_party/upload.py @@ -612,12 +612,19 @@ def GetRpcServer(server, email=None, host_override=None, save_cookies=True, """Prompts the user for a username and password.""" # Create a local alias to the email variable to avoid Python's crazy # scoping rules. + global keyring local_email = email if local_email is None: local_email = GetEmail("Email (login for uploading to %s)" % server) password = None if keyring: - password = keyring.get_password(host, local_email) + try: + password = keyring.get_password(host, local_email) + except: + # Sadly, we have to trap all errors here as + # gnomekeyring.IOError inherits from object. :/ + print "Failed to get password from keyring" + keyring = None if password is not None: print "Using password from system keyring." else: