[Bug 1685547] [NEW] Crash in python3 with the 'file' backend

Jose Manuel Santamaria Lema 1685547 at bugs.launchpad.net
Sat Apr 22 21:04:41 UTC 2017


Public bug reported:

Hi,

I have a program written in python 3 which uses launchpadlib, and it's
crashing if it tries to use the 'file' backend:

$ kubuntu-retry-builds -r frameworks -d artful
Logs are activated and are going to be stored in:
/home/santa/kubuntu-retry-builds_logs
If you want to disable this feature, edit your ~/kubuntu-automation.conf
Date started: Sat, 22 Apr 2017 22:52:10 +0200
The authorization page:
 (https://launchpad.net/+authorize-token?oauth_token=qp1rQXkMXWMMj0pQBHgq&allow_permission=DESKTOP_INTEGRATION)
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 "/usr/bin/kubuntu-retry-builds", line 90, in <module>
    lp = Launchpad.login_with("kubuntu-retry-builds", "production")
  File "/usr/lib/python3/dist-packages/launchpadlib/launchpad.py", line 549, in login_with
    credential_save_failed, version)
  File "/usr/lib/python3/dist-packages/launchpadlib/launchpad.py", line 356, in _authorize_token_and_login
    credentials = authorization_engine(credentials, credential_store)
  File "/usr/lib/python3/dist-packages/launchpadlib/credentials.py", line 553, in __call__
    credential_store.save(credentials, self.unique_consumer_id)
  File "/usr/lib/python3/dist-packages/launchpadlib/credentials.py", line 308, in save
    raise e
  File "/usr/lib/python3/dist-packages/launchpadlib/credentials.py", line 303, in save
    self.do_save(credentials, unique_consumer_id)
  File "/usr/lib/python3/dist-packages/launchpadlib/credentials.py", line 385, 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' 

As a workaround I replaced the file.py line in question with:
password_encrypted = self.encrypt(str(password).encode('utf-8'))
and now it works.

** Affects: python-keyring (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to python-keyring in Ubuntu.
https://bugs.launchpad.net/bugs/1685547

Title:
  Crash in python3 with the 'file' backend

Status in python-keyring package in Ubuntu:
  New

Bug description:
  Hi,

  I have a program written in python 3 which uses launchpadlib, and it's
  crashing if it tries to use the 'file' backend:

  $ kubuntu-retry-builds -r frameworks -d artful
  Logs are activated and are going to be stored in:
  /home/santa/kubuntu-retry-builds_logs
  If you want to disable this feature, edit your ~/kubuntu-automation.conf
  Date started: Sat, 22 Apr 2017 22:52:10 +0200
  The authorization page:
   (https://launchpad.net/+authorize-token?oauth_token=qp1rQXkMXWMMj0pQBHgq&allow_permission=DESKTOP_INTEGRATION)
  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 "/usr/bin/kubuntu-retry-builds", line 90, in <module>
      lp = Launchpad.login_with("kubuntu-retry-builds", "production")
    File "/usr/lib/python3/dist-packages/launchpadlib/launchpad.py", line 549, in login_with
      credential_save_failed, version)
    File "/usr/lib/python3/dist-packages/launchpadlib/launchpad.py", line 356, in _authorize_token_and_login
      credentials = authorization_engine(credentials, credential_store)
    File "/usr/lib/python3/dist-packages/launchpadlib/credentials.py", line 553, in __call__
      credential_store.save(credentials, self.unique_consumer_id)
    File "/usr/lib/python3/dist-packages/launchpadlib/credentials.py", line 308, in save
      raise e
    File "/usr/lib/python3/dist-packages/launchpadlib/credentials.py", line 303, in save
      self.do_save(credentials, unique_consumer_id)
    File "/usr/lib/python3/dist-packages/launchpadlib/credentials.py", line 385, 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' 

  As a workaround I replaced the file.py line in question with:
  password_encrypted = self.encrypt(str(password).encode('utf-8'))
  and now it works.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python-keyring/+bug/1685547/+subscriptions



More information about the foundations-bugs mailing list