Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to write a Python script using launchpadlib that can access the Ubuntu bug database, but I can't find any obvious way to restrict the search to the bugs of a particular project/distro. I know I can access bugs using

bug_one = launchpad.bugs[<bug number>]

and I can access the Ubuntu distribution using

ubuntu = launchpad.distributions['ubuntu']

but I can't find a way to combine the two so that I can retrieve a list of the bugs affecting Ubuntu. The API reference documentation doesn't mention any attribute of the project or distribution entry relating to the actual bugs (just the bug supervisor), nor does the bug entry make it clear what project it affects. Given the way the functions above work, I would have expected

ubuntu_bugs = launchpad.distributions['ubuntu'].bugs[<bug number>]

to return a certain bug affecting Ubuntu, but it doesn't and there's no obvious way to do it.

share|improve this question
up vote 4 down vote accepted

In launchpad there are two different entities:

  • Bugs: General information related to a problem
  • Bug task: Project/Distro specific information: status, importance, assigned to, etc.

Note that a bug is a general concept that might contain multiple tasks that are targeted against milestones for projects and distros. Hence, what you can search for a given project are the bug tasks that have been targeted for that project, not the bugs themselves (you can get the bug for each bug task though).

Hence, the way to look for the bug information would be as follows:

ubuntu = launchpad.distributions['ubuntu']
tasks = ubuntu.searchTasks()
task = tasks[0]    # Get one task as an example
task.bug           # Display bug for the given task

For more information, please have a look at the API documentation for the searchTasks method (in particular, the status parameter is quite useful).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.