mailbox module broken!

Stuart D. Gathman stuart at
Thu Oct 3 19:36:47 CEST 2002

The following trivial code to read through a unix mailbox skips a little
over 100 messages in the mailbox at

I have tested python-2.1.3 and python2-2.2.1

import mailbox

f = open('inbox','r')
mbox = mailbox.UnixMailbox(f)
while 1:
  msg =
  if msg == None: break
  subj = msg.getheader('subject')
  print subj,msg.getheader('date')

Programs such as pine and mozilla, and imap have no trouble reading the
mailbox.  Looking at the mailbox with vi, I can see no reason why it
shouldn't work.  The last message seen by 'mailbox' is 

abc0004 backup Tue, 1 Oct 2002 02:50:04 -0400

This is *not* the last message in the mailbox.

What is going on?

	      Stuart D. Gathman <stuart at>
Business Management Systems Inc.  Phone: 703 591-0911 Fax: 703 591-6154
"Confutatis maledictis, flamis acribus addictis" - background song for
a Microsoft sponsored "Where do you want to go from here?" commercial.

More information about the Python-list mailing list