Iterating into maildir or mbox

T

TheSaint

Hello,

originally with python 2.4 ~ 2.7 (I think) iterating a maildir I was using

++++++++++++++++++++++++++Code+++++++++++++++++++++++++++++++++
try:
mbox= mailbox.PortableUnixMailbox(open(mbox,'r'))
except IOError:
# if file not found default is None
mbox= None
while mbox:
msg= next(mbox)
if msg is None: break
try:
m= msg.getheader('message-id')
if m: dx= m.strip('<>')
else: continue
except (IndexError, AttributeError, IOError):
# message without ID, put some mark
dx= str(time.time()).split('.')
dx= int(dx[0])*int(dx[1])
if dx in lmbox:continue
lmbox[dx]= dx
return lmbox
++++++++++++++++++++++++++Code+++++++++++++++++++++++++++++++++

I'm tryng to convert into Python 3.2, but I don't get why this is not
iterable anymore.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top