On Thu, Mar 21, 2013 at 11:45:22AM +1100, raf wrote: > > the python code needs to be changed to write the "From " header, then the > message, then the blank line. > Then it appears to be a bug in the Python mailbox library code. I have attached it here. If you look through you will see, in the mbox class, the following:-
def _pre_message_hook(self, f): """Called before writing each message to file f.""" if f.tell() != 0: f.write(os.linesep) I.e. it writes a line separator to the mbox file *before* appending a new message. I suppose it could be said that this guarantees the mbox is correctly formatted even if the *previous* writer to the mbox hasn't put a blank line there. By the way I tested mutt itself and it *doesn't* put a blank line between messages, the 'From xxxxx' line is immediately after the last line of text of the previous message. I have fixed the problem for myself by creating a class derived from mailbox.mbox and overriding _pre_message_hook(). -- Chris Green
mailbox.py.gz
Description: Binary data