[New-bugs-announce] [issue11401] email.header error during .flatten()

Steffen Daode Nurpmeso report at bugs.python.org
Fri Mar 4 21:49:46 CET 2011


New submission from Steffen Daode Nurpmeso <sdaoden at googlemail.com>:

Hello, David, the error from Issue 11116 occurred again,
and it still can be healed with the patch file20675.
(I'm opening a new issue because 11116 turned over to
the mailbox fix.
My repo and installation is at:

21:34 ~/arena/code.extern.repos/py3k.hg $ hg identify
ddd8bf84e27d+ (py3k) tip
21:34 ~/arena/code.extern.repos/py3k.hg $ hg slog -r tip
changeset:   10028:ddd8bf84e27d
branch:      py3k
tag:         tip
user:        eli.bendersky
date:        Fri Mar 04 11:38:14 2011 +0100
summary:     [svn r88742]

Here is the dump:

| Opening mbox mailbox /private/var/folders/Da/DaZX3-k5G8a57zw6MSmjJ++++TM/-Tmp-/mail/test
David: <class 'mailbox.mbox'>  <->  <class 'mailbox.MaildirMessage'>
PANIC: [box] test: message-add failed.
  Traceback (most recent call last):
    File "/Users/steffen/usr/bin/s-postman.py", line 1093, in save_ticket
      mb.add(ticket.message())
	...
        try:
            print('David:', type(mb), ' <-> ', type(ticket.message()))
            mb.add(ticket.message())
            mb.flush()
        except Exception as e:
            efun('[box] ', self.id, ': message-add failed.\n', extb=E())
        finally:
            mb.unlock()
	...
    File "/Users/steffen/usr/opt/py3k/lib/python3.3/mailbox.py", line 595, in add
      self._toc[self._next_key] = self._append_message(message)
    File "/Users/steffen/usr/opt/py3k/lib/python3.3/mailbox.py", line 733, in _append_message
      offsets = self._install_message(message)
    File "/Users/steffen/usr/opt/py3k/lib/python3.3/mailbox.py", line 805, in _install_message
      self._dump_message(message, self._file, self._mangle_from_)
    File "/Users/steffen/usr/opt/py3k/lib/python3.3/mailbox.py", line 215, in _dump_message
      gen.flatten(message)
    File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/generator.py", line 88, in flatten
      self._write(msg)
    File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/generator.py", line 141, in _write
      self._write_headers(msg)
    File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/generator.py", line 373, in _write_headers
      self.write(header.encode(linesep=self._NL)+self._NL)
    File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/header.py", line 317, in encode
      formatter.feed(lines[0], charset)
  Exception: IndexError: list index out of range

In the meanwhile the thing has dispatched tens of thousands
of mails, and no error did ever occur (reading from MBox,
storing as Maildir).  This happened when saving the first
message read from a Maildir mailbox to a MBox one.
I think i'll gonna do some round-trip tests tomorrow and
monday evening+.  Anyway, patching in file20675 heals the
problem and the thing finishs gracefully.

----------
components: Library (Lib)
messages: 130072
nosy: r.david.murray, sdaoden
priority: normal
severity: normal
status: open
title: email.header error during .flatten()
type: behavior
versions: Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11401>
_______________________________________


More information about the New-bugs-announce mailing list