Adding tags to a Launchpad bug using launchpadlib

I found the solution here but it was buried a bit in the bug comments. If you ever try something like the code below to append a tag to an existing Launchpad bug using launchpadlib, it won’t work work. It fails silently.

bug = launchpad.bugs[1]
bug.tags.append('new-tag')
bug.lp_save()

The solution is to do something like this instead:

bug = launchpad.bugs[1]
bug.tags = bug.tags + ['new-tag']
bug.lp_save()

Not too bad. Of course, if you try the first approach initially, which seems like it would/should work but fails silently, you could go out of your mind. Sanity returns.

🙂

Leave a comment