ValueError: Unsupported attachment-type '<type 'set'>'

Bug #191963 reported by Markus Korn
4
Affects Status Importance Assigned to Milestone
python-launchpad-bugs
Fix Released
Undecided
Unassigned

Bug Description

Traceback (most recent call last):
  File "/home/ubuntu-archive/apport-retracer-i386/bin/crash-digger", line 224, in <module>
    opts.dup_db, opts.arch_indep_dupcheck, opts.logfile, opts.pidfile).run()
  File "/home/ubuntu-archive/apport-retracer-i386/bin/crash-digger", line 148, in run
    self.dupcheck_next()
  File "/home/ubuntu-archive/apport-retracer-i386/bin/crash-digger", line 129, in dupcheck_next
    res = self.crashdb.check_duplicate(id)
  File "/home/ubuntu-archive/apport-retracer-i386/apport/apport/crashdb.py", line 92, in check_duplicate
    report = self.download(id)
  File "/home/ubuntu-archive/apport-retracer-i386/apport/apport/crashdb_impl/launchpad.py", line 129, in download
    for att in b.attachments.filter(lambda a: re.match(
  File "/home/ubuntu-archive/apport-retracer-i386/apport/launchpadbugs/lphelper.py", line 259, in <lambda>
    if fget : fget = lambda s, n=fget.__name__ : getattr(s, n)()
  File "/home/ubuntu-archive/apport-retracer-i386/apport/launchpadbugs/html_bug.py", line 87, in func
    x.parse()
  File "/home/ubuntu-archive/apport-retracer-i386/apport/launchpadbugs/html_bug.py", line 617, in parse
    super(Attachments, self).parse()
  File "/home/ubuntu-archive/apport-retracer-i386/apport/launchpadbugs/attachmentsbase.py", line 320, in parse
    r = self.__comments.parse()
  File "/home/ubuntu-archive/apport-retracer-i386/apport/launchpadbugs/html_bug.py", line 708, in parse
    c = Comment(text=com_text, attachments=com_attachments)
  File "/home/ubuntu-archive/apport-retracer-i386/apport/launchpadbugs/html_bug.py", line 673, in __init__
    LPComment.__init__(self, subject, text, attachments)
  File "/home/ubuntu-archive/apport-retracer-i386/apport/launchpadbugs/commentsbase.py", line 15, in __init__
    raise ValueError, "Unsupported attachment-type '%s'" %type(attachments)
ValueError: Unsupported attachment-type '<type 'set'>'

there are two issues:
1.) An error message which leads in the wrong direction, i guess this is not related to the contenttype
2.) there seems to be something wrong with the parsing of attachments.

Markus

Revision history for this message
Markus Korn (thekorn) wrote :

this happens while parsing Bug 191065

Changed in python-launchpad-bugs:
assignee: nobody → thekorn
status: New → In Progress
Revision history for this message
Markus Korn (thekorn) wrote :

<seb128> thekorn: seems to crash on bug #191627 now

Revision history for this message
Martin Pitt (pitti) wrote :

I don't think that this is a duplicate. The code does

        if attachments is None:
            attachments = set()
        if isinstance(attachments, LPAttachment):
            self.__attachments = set([attachments])
        else:
            if not any(map(lambda x: isinstance(x, LPAttachment), attachments)):
                raise ValueError, "Unsupported attachment-type '%s'" %type(attachments)
            self.__attachments = set(attachments)

I. e. if attachments is the empty set (if none was given), then any(empty set) is false, and thus the exception is raised.

I did a quick fix:

            if attachments and not any(map(lambda x: isinstance(x, LPAttachment), attachments)):

but the if/else clauses should be restructured. On hindsight, it would probably be better to write

  if attachment is None:
  ...
  elif isinstance(attachments, LPAttachment):
  ...
  else
   ... # check set items

Revision history for this message
Markus Korn (thekorn) wrote :

Is this still an issue? - I have not seen this bug any more, there recently also were fundamental changes to the code in .main.

Markus

Changed in python-launchpad-bugs:
assignee: thekorn → nobody
status: In Progress → Incomplete
Revision history for this message
Martin Pitt (pitti) wrote :

I haven't seen it recently, so let's deem it fixed. Thanks!

Changed in python-launchpad-bugs:
status: Incomplete → Fix Released
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.