mailbox.py - bug or my fault?

Jeff Epler jepler at unpythonic.net
Thu May 15 21:31:18 EDT 2003


If I had to guess, I'd wonder whether mailbox.PortableUnixMailbox seeks
unportably.

In theory, you can't choose arbitrary byte offsets for seek in text-mode
files (this is a deliberate limitation of the C standard library).
You opened your mailbox with "w", not "wb".

On Unix it works, by happy coincidence (because all files are binary
files).  On DOS, where writing '\n' changes the file position by 2, it
fails.  It would also fail on a system with record-oriented text files,
for instance.

Change your "w" to "wb" and try again.

Jeff





More information about the Python-list mailing list