[Spambayes] Questions about IMAPFilter

Woo, Christopher Christopher.Woo at pepperdine.edu
Tue Jul 20 17:55:52 CEST 2004

> > Here is my situation: I'd like to be able to run 
> > sb_imapfilter.py as a service or a cron job when the 
> > Administrator is logged out. Has anyone been able to do this 
> > with any of the various W32 cron tools, or with something 
> > like FireDaemon?
> How familiar are you with Python?  In the windows directory 
> of the source
> archive there's a script called "pop3proxy_service.py" which 
> basically turns
> the sb_server.py script into a Windows service.  It shouldn't be too
> difficult to write an imapfilter_service.py script that does 
> the same thing
> for sb_imapfilter.py, based on that example.  (If you do do this, then
> contributing the code back would be fantastic!).

Yikes! Well beyond my capabilities! Though this would be very useful to me
if someone else took up the challenge...

> > I've tried Pycron, which has no problem executing the 
> > sb_imapfilter.py script, but it looks like when it is run via 
> > Pycron, it's not selecting the correct profile, and therefore 
> > does not work. Is this something that can be defined from the 
> > command line, or hard-coded into the script?
> I don't know what Pycron allows (if it is an actual service, 
> then you can
> choose which account it uses).  However, I presume that all 
> you care about
> is that it can find the configuration file & databases.  The 
> locations of
> the databases can be changed (via the web interface or just 
> manually in the
> configuration file) to whatever you like.  If you give a 
> relative path then
> it's taken relative to the configuration file; if you give an 
> absolute path,
> then it's just that.  To find the configuration file, 
> SpamBayes looks for an
> environment variable BAYESCUSTOMIZE holding the full path to 
> the file, then
> in the current working directory (maybe Pycron can set 
> this?), then, on
> Windows, in the {Application Data}\SpamBayes\Proxy directory. 
>  The easiest
> solution would be to set the environment variable.
> =Tony Meyer

Actually, what it turned out to be was that Pycron was executing the script
from its own directory, instead of the \spambayes\scripts directory, so the
sb_imapfilter.py script was unable to find the rest of the needed scripts in
\spambayes\spambayes. I solved this by creating a .bat file that included
the full path to the imapfilter script, and that worked like a charm!

Thanks for your quick reply, Tony! It helped jog loose the couple extra
neurons I needed to solve this.



More information about the Spambayes mailing list