[Bug 1685549] [NEW] login_with() crashes if there's no web browser installed

Jose Manuel Santamaria Lema 1685549 at bugs.launchpad.net
Sat Apr 22 21:09:48 UTC 2017


Public bug reported:

Hi,

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:
/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:36:33 +0200
The authorization page:
 (https://launchpad.net/+authorize-token?oauth_token=tKJzWL79XggpC6g6W3Hv&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 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:
            webbrowser.open(authorization_url)
with this
        if browser is not None:
            webbrowser.open(authorization_url)
fixes the problem for me

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

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

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

Status in python-launchpadlib package in Ubuntu:
  New

Bug description:
  Hi,

  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:
  /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:36:33 +0200
  The authorization page:
   (https://launchpad.net/+authorize-token?oauth_token=tKJzWL79XggpC6g6W3Hv&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 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:
              webbrowser.open(authorization_url)
  with this
          if browser is not None:
              webbrowser.open(authorization_url)
  fixes the problem for me

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



More information about the foundations-bugs mailing list