corrupt cache produces unhelpful error messages

Bug #404204 reported by Brian Murray on 2009-07-24
This bug affects 2 people
Affects Status Importance Assigned to Milestone
python-launchpadlib (Ubuntu)

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 ( 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 "", line 32, in <module>
    launchpad = Launchpad.get_token_and_login(script_name, EDGE_SERVICE_ROOT, cachedir)
  File "/usr/lib/python2.5/site-packages/launchpadlib/", line 154, in get_token_and_login
  File "/usr/lib/python2.5/site-packages/launchpadlib/", 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')
>>> 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/", line 60, in __init__
    self._wadl = self._browser.get_wadl_application(self._root_uri)
  File "/usr/lib/python2.5/site-packages/launchpadlib/", line 230, in get_wadl_application
    return Application(str(url), content)
  File "/usr/lib/python2.5/site-packages/wadllib/", 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) on 2009-08-28
Changed in python-launchpadlib (Ubuntu):
status: New → Triaged
importance: Undecided → Medium
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  Edit
Everyone can see this information.

Other bug subscribers