[New-bugs-announce] [issue9559] mailbox.mbox creates new file when adding message to mbox

Chris Green report at bugs.python.org
Tue Aug 10 18:40:08 CEST 2010

New submission from Chris Green <chris at isbd.co.uk>:

When you call mailbox.mbox.add() the old mbox file is copied, the new file is modified and then renamed to the name of the'old' mbox file.

This breaks the way that many MUAs detect and manage new mail in an mbox, in particular I discovered this with mutt.  If the python process writing the mbox and mutt are on the same system writing a local file then you get the message "Mailbox was externally modified. Flags may be wrong." from mutt (and various odd things can happen).  If mutt is reading the mbox over NFS then you get a "Stale NFS file handle" error.

This should be strongly noted in the documentation for mailbox.mbox, in addition it would be really nice if there was a mailbox.mbox.append() method which *really* appends the data to the end of the mbox rather than changing it completely.

Most MDAs (all?) do just append new mail to the end of the mbox and I feel that python should really try and do the same.

components: Library (Lib)
messages: 113547
nosy: chrisisbd
priority: normal
severity: normal
status: open
title: mailbox.mbox creates new file when adding message to mbox
type: behavior
versions: Python 2.7

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list