# return false (0) on error def read_and_pass_mail(mbox): mail = open(mbox) if not mail: print "Couldn't open mailbox" return 0 else: for line in mail: # pass each line to the parser here print line mail.truncate(0) mail.close() return 1