login_with() crashes if there's no web browser installed

Bug #1685549 reported by Jose Manuel Santamaria Lema on 2017-04-22
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Kubuntu Automation
python-launchpadlib (Ubuntu)

Bug Description


I have a program which uses launchpadlib's login_with, and it's crashing like this in a system without any browser installed:

$ kubuntu-retry-builds -r frameworks -d artful
Logs are activated and are going to be stored in:
If you want to disable this feature, edit your ~/kubuntu-automation.conf
Date started: Sat, 22 Apr 2017 22:36:33 +0200
The authorization page:
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 548, in __call__
    self.make_end_user_authorize_token(credentials, request_token_string)
  File "/usr/lib/python3/dist-packages/launchpadlib/credentials.py", line 656, in make_end_user_authorize_token
    if browser_obj is not None:
UnboundLocalError: local variable 'browser_obj' referenced before assignment

replacing this code
        if browser_obj is not None:
with this
        if browser is not None:
fixes the problem for me

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package python-launchpadlib - 1.10.5-1

python-launchpadlib (1.10.5-1) unstable; urgency=medium

  * Team upload.
  * New upstream release:
    - Fix fallback if authorizing a token with a browser raises
      webbrowser.Error (LP: #1685549).

 -- Colin Watson <email address hidden> Tue, 05 Sep 2017 12:36:21 +0100

Changed in python-launchpadlib (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers