corrupt cache produces unhelpful error messages

Bug #404204 reported by Brian Murray
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
launchpadlib
Triaged
Low
Unassigned
python-launchpadlib (Ubuntu)
Triaged
Medium
Unassigned

Bug Description

Binary package hint: python-launchpadlib

My launchpadlib scripts on a server in the data center were not running at all and I was receiving the following error:

The authorization page (https://edge.launchpad.net/+authorize-token?oauth_token=.....) should be opening in your
browser. After you have authorized this program to access Launchpad on your behalf you should come back here and press <Enter>
to finish the authentication process.
Traceback (most recent call last):
  File "package-bugs-numdupesgt2.py", line 32, in <module>
    launchpad = Launchpad.get_token_and_login(script_name, EDGE_SERVICE_ROOT, cachedir)
  File "/usr/lib/python2.5/site-packages/launchpadlib/launchpad.py", line 154, in get_token_and_login
    credentials.exchange_request_token_for_access_token(web_root)
  File "/usr/lib/python2.5/site-packages/launchpadlib/credentials.py", line 179, in exchange_request_token_for_access_token
    raise HTTPError(response, content)
launchpadlib.errors.HTTPError: HTTP Error 401: Unauthorized

However, my credentials were good and I had successfully used the same ones on my system at home. While investigating the problem I received this traceback:

brian@cranberry:~$ python
Python 2.5.2 (r252:60911, Jul 22 2009, 15:33:10)
[GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.path.expanduser('~/.launchpadlib/backwater.cred')
'/home/brian/.launchpadlib/backwater.cred'
>>> from launchpadlib.launchpad import Launchpad, EDGE_SERVICE_ROOT, STAGING_SERVICE_ROOT
>>> from launchpadlib.errors import HTTPError
>>> from launchpadlib.credentials import Credentials
>>> credentials = Credentials()
>>> credfile = os.path.expanduser('~/.launchpadlib/backwater.cred')
>>> credentials.load(open(credfile))
>>> cachedir = os.path.expanduser("~/.launchpadlib/cache/")
>>> launchpad = Launchpad(credentials, EDGE_SERVICE_ROOT, cachedir)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/site-packages/launchpadlib/launchpad.py", line 60, in __init__
    self._wadl = self._browser.get_wadl_application(self._root_uri)
  File "/usr/lib/python2.5/site-packages/launchpadlib/_browser.py", line 230, in get_wadl_application
    return Application(str(url), content)
  File "/usr/lib/python2.5/site-packages/wadllib/application.py", line 885, in __init__
    self.doc = ET.fromstring(markup)
  File "<string>", line 86, in XML
SyntaxError: no element found: line 14374, column 4

After some lucky guesswork I moved aside my cachedir and was able to successfully use launchpadlib again. Determining the source of the problem was very cryptic and I think the error messages could be more informative.

I was using python-launchpadlib version 0.2~bzr25-0ubuntu1~CAT.8.04. I have the broken cache directory available still if it would be helpful.

James Westby (james-w)
Changed in python-launchpadlib (Ubuntu):
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Gary Poster (gary) wrote :

The corrupt cache itself was presumably caused by bug 459418.

Changed in launchpadlib:
status: New → Triaged
importance: Undecided → Low
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.