2

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.

1 Answer 1

4

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).

You must log in to answer this question.