On Mon, Feb 15, 2010 at 3:42 PM, MRAB <pyt...@mrabarnett.plus.com> wrote: > BJ Swope wrote: > [snip] >> >> def clean_stale_mail(): >> msg_date1= the_email.get('Date') > > What is the value of 'msg_date1' at this point? > >> msg_date2 = email.utils.parsedate_tz(msg_date1) > > What is the value of 'msg_date2' at this point? > > The docs say that parsedate_tz() can return a 10-tuple or None. > > Presumably, if it can't parse the date then it returns None. >
> [snip] > msg_date1: @@DATE msg_date2: None Thanks MRAB, Dave and Stephen! The spam bot didn't populate the date field with anything remotely resembling the date. The @@DATE var was left in the Date header. In reading the module I misunderstood what the "if date[9] is None:" was doing. I'll wrap my calls in a try/except. -- http://mail.python.org/mailman/listinfo/python-list