[Tutor] problem with key in mailbox.Maildir

Kantesh Raj kantesh555 at gmail.com
Fri Mar 30 18:05:33 CEST 2012


hi everyone,
i am not able to get email from my mailbox by using key.
key is automatically removed after program termination but file is present
there.
i get data by same code method by using fresh key (which is generated by
adding email again)

import mailbox
mailb = mailbox.Maildir('~/Maildir',factory=none)
k=mailb.get_file('1333110477.M317089P8312Q1.Kantesh-Pc')
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/usr/lib/python2.7/mailbox.py", line 359, in get_file
    f = open(os.path.join(self._path, self._lookup(key)), 'rb')
  File "/usr/lib/python2.7/mailbox.py", line 529, in _lookup
    raise KeyError('No message with key: %s' % key)
KeyError: 'No message with key: 1333110477.M317089P8312Q1.Kantesh-Pc

how to get email by key???
thanks in advance for help
-- 
Kantesh Raj
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120330/abc99916/attachment.html>


More information about the Tutor mailing list