[Spambayes] sb_imapfilter

vbargsten beer at freakmail.de
Sun Mar 25 15:32:03 CEST 2007


hi again,

i finally figured out the problem more exactly.

a socket error exception is raised with errno 11 and message
Resource temporarily unavailable
which rather means try again, no data was available.

i found out using some more output in sb_imapfilter.py

row 189:
        try:
            BaseIMAP.__init__(self, server, port)
        except (BaseIMAP.error), inst:
            print "Cannot connect to server %s on port %s." % (server, port)
            print "BaseIMAP.error Exception: ",  (inst)
            if not hasattr(self, "ssl"):
                print "If you are connecting to an SSL server, please " \
                      "ensure that you have the 'Use SSL' option enabled."
            self.connected = False
        except (socket.gaierror), inst:
            print "Cannot connect to server %s on port %s." % (server, port)
            print "socket.gaierror Exception: ",  (inst)
            if not hasattr(self, "ssl"):
                 print "If you are connecting to an SSL server, please " \
                       "ensure that you have the 'Use SSL' option enabled."
            self.connected = False
        except (socket.error), inst:
            print "Cannot connect to server %s on port %s." % (server, port)
            print "socket.error Exception: ",  (inst)
            if not hasattr(self, "ssl"):
                 print "If you are connecting to an SSL server, please " \
                       "ensure that you have the 'Use SSL' option enabled."
            self.connected = False
        else:
            self.connected = True

basically i fixed it by catching errors with errno 11 . maybe this means 
the same as 10035 windows errorcode

line 246

            try:
                data = self.sock.recv(1)
            except socket.error, e:
                #print "Errorcode when receiving: ", e[0], ", ", 
e.errorcode[e[0]]
                if e[0] == 10035:
                    # Nothing to receive, keep going.
                    continue
                if e[0] == 11:
                    # Nothing to receive, keep going.
                    continue
                raise


cu
vbargsten

vbargsten schrieb:
> hi,
>
> i am using sb_imapfilter.py to train messages of imap mailboxes.
> filtering is done via procmail and sb_filter.
> but there's a problem when calling "sb_imapfilter.py -t". often it does
> not work, especially when called the first time,
> where 'first time' is not meant as the first time ever called for that
> user, only the last time called was a day or so before.
> when called the second time right after the first unseccessful call, it
> seems to be always seccessful.
> as i run it with cron, it should be reliable.
>
> the filtering itself works vey good and i like spambayes, so i dont want
> to use something else.
> the imap server is a cyrus on the same machine with suse linux 9.3 x86_64.
>
> here is what i do:
>
> -------------------------------------------------------------------------------------
> testuser at linux-server:~> sb_imapfilter.py -t
> SpamBayes IMAP Filter Version 1.1a3 (August 2006).
>
> Loading state from /home/testuser/.hammie.db database
> /home/testuser/.hammie.db is an existing database, with 148 spam and 43 ham
> Loading database /home/testuser/.hammie.db... Done.
> Cannot connect to server localhost on port 143
> If you are connecting to an SSL server, please ensure that you have the
> 'Use SSL' option enabled.
> Account: localhost:143
> testuser at linux-server:~> sb_imapfilter.py -t
> SpamBayes IMAP Filter Version 1.1a3 (August 2006).
>
> Loading state from /home/testuser/.hammie.db database
> /home/testuser/.hammie.db is an existing database, with 148 spam and 43 ham
> Loading database /home/testuser/.hammie.db... Done.
> Account: localhost:143
> Training
>    Training ham folder INBOX
> .........................................................................................................................................................................................................................................................................................**************************************************************
>        62 trained.
>    Training spam folder INBOX.spam
> ...........................................................................................................................................................................................................................................................................................................................................................................................................................................................************************************************************************************************************************************
>        132 trained.
> Persisting /home/testuser/.hammie.db state in database
> Training took 18.3412 seconds, 194 messages were trained.
> ------------------------------------------------------------------------------------
>
> here is my bayescustomize.ini:
>
> [Categorization]
> spam_cutoff:0.7
> [Storage]
> messageinfo_storage_file:/home/testuser/.spambayes.messageinfo.db
> persistent_storage_file:/home/testuser/.hammie.db
> [imap]
> password:--secret--
> server:localhost:143
> username:testuser
> ham_train_folders:INBOX
> spam_train_folders:INBOX.spam
> [globals]
> verbose:True
>
>
> thank you for hints
> vbargsten
>
>
> _______________________________________________
> SpamBayes at python.org
> http://mail.python.org/mailman/listinfo/spambayes
> Check the FAQ before asking: http://spambayes.sf.net/faq.html
>
>
>   



More information about the SpamBayes mailing list