[Spambayes] imap4 filter

Neal Stoughton nmstough at uci.edu
Mon Dec 29 14:11:41 EST 2003

----- Original Message ----- 
From: "Tony Meyer" <tameyer at ihug.co.nz>
To: "'Neal Stoughton'" <nmstough at uci.edu>; <spambayes at python.org>
Sent: Sunday, December 28, 2003 21:20
Subject: RE: [Spambayes] imap4 filter

> First note that in order to open the configuration web
> interface I have to run "python scripts/sb_imapfilter.py -b".

That is correct.  In the next release you can serve the interface without
launching a browser window, but in 1.0a7 you cannot (you can close the
browser window, leave imapfilter running and then open it again).

> The web interface will not open with http://localhost:8880,

Unless sb_imapfilter.py is running, right?

> possibly because there is no running web server
> unless the script is executed first?

The sb_imapfilter.py script serves the web interface, yes.  It has to get
there somehow!

> After I log out of the machine it seems that the web server is
> stopped, so presumably the mail isnt being filtered?

That is correct.  sb_imapfilter filters when it is run, and then does
nothing.  You can set it to filter repeatedly, but if you stop it (or don't
set it to repeat), then that's it.

I guess I misunderstood how this works.  I thought somehow running 
sb_impfilter.py would start up some sort of "service" that would run 
constantly on my server, even when no one is logged into it (like the mail 
service).  That way, I could access and configure it whenever I wanted 
remotely from a web browser.  But it seems that at least the imap filter 
part of spambayes is set up more from the standpoint of a client machine 
(the workstation) rather than to run on a server.  Now that I understand the 
structure of this module a little better it makes sense that way.  But 
reading the whole of the instructions including the pop3 part, confused me 
as to how the imap filter module worked.

> Heres what I get from the web interface when I select
> "configure folders to filter":
>   File
> "c:\python23\Lib\site-packages\spambayes\PyMeldLite.py", line 499, in
> feed
>     self._parser.Parse(data)
> ExpatError: not well-formed (invalid token): line 1, column 70

This is a *bad* thing - it means that the ui_html.py file in the spambayes
package is no good.  It works for me here, but I don't have time right at
the moment to grab a copy of 1.0a7 and see if that's because it has been
fixed since (I don't recall that it was, but it's been a while).  Have you
changed this file at all?  Do you have resourcepackage installed (unlikely,
but a possible cause).

No, I made no changes whatsoever; all I did was install the python package 
to c:\python23 and then run the install package setup.py.  This seemed to 
copy some items into various subfolders within the \python23 folder.  Then I 
started the imap filter and tried to configure it.  I had a problem at 
first, because after putting in the information about the mail server, I had 
to stop the process and restart it before I could proceed.  Then I tried to 
configure the filtering and this is where I ran into the errors.  Not 
knowing what the resourcepackage is, I did not install that.  I didnt 
install the win32 package either.

> Because the POP3 instructions appear before the IMAP
> instructions and there isnt a statement saying to skip them if
> youre only using IMAP, this isnt clear.

Did you also try to use the Outlook instructions before POP3 and the
procmail ones after IMAP <0.5 wink>?  I'll add a line saying to only follow
the relevant section.

No, there was enough explanation in the notes that made it clear that if you 
dont use either Outlook or procmail, then you wouldnt go through that 
installation.  I suppose I wouldnt have questioned the instructions if 
everything worked, but because of the errors, I began to wonder if somehow 
the imap filter depended on the pop3 service.

> I also had some problems figuring out how to install
> spambayes after installing python.  When it says to run
> "setup.py install" for instance, this skips some matters.
> I had to open a command
> prompt, page through to the folder where the script was located;

This was considered existing knowledge for users (i.e. was implied in "in
directory that you expanded the SpamBayes archive into").  I've elaborated
it somewhat, although for users for whom this doesn't come easily, the (soon
to be released) binary version will solve this problem (although the first
release probably won't include imapfilter).

> then I had to use the command "c:\python23\python setup.py install"
> since the executable couldnt otherwise be found.

This depends on how you installed Python.  If python isn't on your path,
then you have to use the full path, otherwise you don't.  Either way, we
can't guess what the correct path will be.  I'm leaving this one, because
IMO if people can't figure this out (you did, obviously) then they shouldn't
be running from source.

I was wondering, though, why the python installation doesnt put something 
into the registry that identifies to other programs where the python 
executable is located.  For instance, I dont have to put programs like Adobe 
Acrobat into the path in order for my *.pdf files to find the appropriate 
program.  In any event, this is more of a question for the python developers 
than it is for spambayes.

More information about the Spambayes mailing list