← Back to team overview

group.of.nepali.translators team mailing list archive

[Bug 1685962] Re: keyring file-backend reports backtrace with oauth

 

Fixed in launchpadlib 1.10.6.

** Changed in: launchpadlib
       Status: Confirmed => Fix Released

-- 
You received this bug notification because you are a member of नेपाली
भाषा समायोजकहरुको समूह, which is subscribed to Xenial.
Matching subscriptions: Ubuntu 16.04 Bugs
https://bugs.launchpad.net/bugs/1685962

Title:
  keyring file-backend reports backtrace with oauth

Status in launchpadlib :
  Fix Released
Status in python-launchpadlib package in Ubuntu:
  Confirmed
Status in python-launchpadlib source package in Xenial:
  Confirmed
Status in python-launchpadlib source package in Artful:
  Confirmed
Status in python-launchpadlib source package in Bionic:
  Confirmed

Bug description:
  When bringing the importer back up, I ran into the following:

  The authorization page:
   (<ELIDED>)
  should be opening in your browser. Use your browser to authorize
  this program to access Launchpad on your behalf.
  Waiting to hear from Launchpad about your decision...
  Traceback (most recent call last):
    File "./bin/usd", line 17, in <module>
      main()
    File "/home/ubuntu/usd-importer/usd/__main__.py", line 172, in main
      args.func(args)
    File "/home/ubuntu/usd-importer/usd/importer.py", line 1230, in main
      lp = launchpad_login_auth()
    File "/home/ubuntu/usd-importer/usd/source_information.py", line 47, in launchpad_login_auth
      version=_lp_api_version)
    File "/usr/lib/python3/dist-packages/launchpadlib/launchpad.py", line 544, in login_with
      credential_save_failed, version)
    File "/usr/lib/python3/dist-packages/launchpadlib/launchpad.py", line 351, in _authorize_token_and_login
      credentials = authorization_engine(credentials, credential_store)
    File "/usr/lib/python3/dist-packages/launchpadlib/credentials.py", line 552, in __call__
      credential_store.save(credentials, self.unique_consumer_id)
    File "/usr/lib/python3/dist-packages/launchpadlib/credentials.py", line 307, in save
      raise e
    File "/usr/lib/python3/dist-packages/launchpadlib/credentials.py", line 302, in save
      self.do_save(credentials, unique_consumer_id)
    File "/usr/lib/python3/dist-packages/launchpadlib/credentials.py", line 384, in do_save
      'launchpadlib', unique_key, serialized)
    File "/usr/lib/python3/dist-packages/keyring/core.py", line 48, in set_password
      _keyring_backend.set_password(service_name, username, password)
    File "/usr/lib/python3/dist-packages/keyring/backends/file.py", line 87, in set_password
      password_encrypted = self.encrypt(password.encode('utf-8'))
  AttributeError: 'bytes' object has no attribute 'encode'

  cjwatson on IRC suggested this is probably a simple change in
  launchpadlib:

  === modified file 'src/launchpadlib/credentials.py'
  --- src/launchpadlib/credentials.py	2016-08-15 10:32:44 +0000
  +++ src/launchpadlib/credentials.py	2017-04-24 16:28:46 +0000
  @@ -380,7 +380,7 @@ class KeyringCredentialStore(CredentialS
           # this problem by base 64 encoding the serialized value.
           serialized = self.B64MARKER + b64encode(serialized)
           keyring.set_password(
  -            'launchpadlib', unique_key, serialized)
  +            'launchpadlib', unique_key, serialized.decode('utf8'))
   
       def do_load(self, unique_key):
           """Retrieve credentials from the keyring."""

  which ensures unicode is always passed down, but it needs further
  testing. It does fix the issue in my particular case.

To manage notifications about this bug go to:
https://bugs.launchpad.net/launchpadlib/+bug/1685962/+subscriptions