[Spambayes] Re: imapfilter mangling headers!

Meyer, Tony T.A.Meyer at massey.ac.nz
Sun Apr 20 15:16:57 EDT 2003

[Time error]
> > I've checked in a fix for this.
> Not yet, I think. After an update:
>     %python imapfilter.py -c -D ~/bayes.db
>     Traceback (most recent call last):
>       File "imapfilter.py", line 509, in ?
>         run()
>       File "imapfilter.py", line 499, in run
>         imap_filter.Filter()
>       File "imapfilter.py", line 391, in Filter
>         self.unsure_folder)
>       File "imapfilter.py", line 350, in Filter
>         msg.Save()
>       File "imapfilter.py", line 201, in Save
>         msg_time = self.extractTime()
>       File "imapfilter.py", line 178, in extractTime
>         return imaplib.Time2Internaldate(\
>     TypeError: argument must be 9-item sequence, not None

A couple of things that are odd here.  The first is that extractTime
should almost never be called now - the imap server should provide the
time.  Could you execute the following and tell me what you get?
(replacing the server-specific stuff, obviously)

>>> import imaplib
>>> imap = imaplib.IMAP4("mail.example.com")
>>> imap.login("username", "password")
>>> imap.select()
>>> imap.fetch("1:1", "(INTERNALDATE)")
>>> imap.logout()

The other odd thing is that the date header is definitely present
(otherwise line 178 wouldn't execute) so it's either parsedate or mktime
that's returning None.  Could you change line 178 to this and let me
know what prints out?

            Pd = parsedate(message_date)
            print pd
            md = mktime(pd)
            print md
            t2i = imaplib.Time2Internaldate(md)
            print t2i
            return t2i

Thanks for the help in tracing these down.  Given the way that each imap
server software seems to put it's own interpretation on the RFC, we need
as many testers as possible.

=Tony Meyer

More information about the Spambayes mailing list