TypeError Exception in email lib

John Yeung gallium.arsenide at gmail.com
Mon Feb 15 15:59:01 EST 2010


On Feb 15, 2:54 pm, BJ Swope <bigbluesw... at gmail.com> wrote:

> def clean_stale_mail():
>     msg_date1= the_email.get('Date')
>     msg_date2 = email.utils.parsedate_tz(msg_date1)
>     try:
>         utc_msg_date = email.utils.mktime_tz(msg_date2)
>     except OverflowError:
>         M.store(msg_id, '+FLAGS.SILENT', '\\Deleted')
>         return
>     utc_stale_date = time.time() - (86000*stale_days)
>     if utc_msg_date <= utc_stale_date:
>         M.store(msg_id, '+FLAGS.SILENT', '\\Deleted')

It looks like msg_date1 is None.  That is, 'Date' is not found in
the_email.

As Dave Angel said, your "patch" shouldn't fix this problem anyway.
Use your patch and put the same problematic input in it to see if it
really does fix the problem.  (Just to satisfy our morbid curiosity,
not really to help you get a true solution.)

It looks to me like you have to do something to make clean_stale_mail
more robust, rather than focusing on anything in the standard library.

John



More information about the Python-list mailing list