[Spambayes] Win32 Command Line

Tony Meyer tameyer at ihug.co.nz
Tue Oct 12 06:45:51 CEST 2004

> Moving right along now.  You were exactly correct as to the 
> location of the Outlook spam database.  I found it and have 
> attempted the above command.  At this point I wish I new 
> Python...  :-)  I receive the following error:
> Traceback (most recent call last):
> IOError: [Errno 9] Bad file descriptor
> Does this mean that the message is in the wrong format?  
> Perhaps it's not a true Unix mbox format?  I tried to google 
> the actual specification for the mbox format, and the only 
> reference regarding the format I could find was that the 
> message started after the "From:"  That's not a lot of help!

That could be the error.  What does the message look like?  It should be in
standard RFC822 format, with or without the leading "From:" line.  i.e.
something like:

Subject: This is a test
To: tameyer at ihug.co.nz
X-Otherheader: example

Body of message is here.

i.e. a collection of headers, one on each line (possibly with continuations)
and then a blank line, then the body.

> So, I looked over the code, just in case I could figure 
> something out.  It seems that the code is written to handle 
> malformed messages gracefully with a lovely try/except 
> construct.

What version of Python are you using, BTW?  Python 2.4's email package is
much better equipped to handle malformed messages.  2.4's only in alpha, but
it's pretty stable, and b1 should be out soon, I think.

> It's failing when it tries to read in the string. 
> So I looked around some more and I see that I should be able 
> to pass it +[directory] to process files in a directory.

I'm not familiar with that option, but the docstring (i.e. sb_filter.py -h)
says that it's a "MH folder", which is not quite the same thing as a
directory of mbox files, I don't think.  (I don't know pretty much anything
about MH).

However, if you leave out the '+', then (as long as the directory doesn't
have subdirectories called 'cur' or 'Mail'), it should work with a
collection of plain text emails.

If it still fails, try putting a "print path" line before the one that dies,
and see what it prints out.

=Tony Meyer

Please always include the list (spambayes at python.org) in your replies
(reply-all), and please don't send me personal mail about SpamBayes. This
way, you get everyone's help, and avoid a lack of replies when I'm busy.

More information about the Spambayes mailing list