[Spambayes] imapfilter repeat problem

Oliver Maunder lists at olivermaunder.co.uk
Mon Apr 28 15:58:45 EDT 2003

Just been running imapfilter with the -l flag to get it to periodically 
classify my inbox. The second round of classifying caused an error:

       "imaplib.error: command LOGIN illegal in state LOGOUT"

Clearly, logging out after the initial round of classifying has left the 
imap object in the LOGOUT state, and it doesn't want you to log in when 
it's in that state. Personally I think that's probably an error in 
imaplib (what else are you going to do with a logged out object other 
than log in again?) .

In the meantime there's a simple fix - move the line where the 
IMAPSession is created inside the while loop, so a new IMAPSession is 
created on each pass.
e.g. - line 633, imapfilter.py
    while True:
          imap = IMAPSession(server, port, imapDebug, doExpunge)
          imap.login(username, pwd)

I still don't know much about python. Will the old IMAPSession object 
will be cleaned up properly if I do this?


More information about the Spambayes mailing list