[Spambayes] Win32 Command Line

Joshua Olson joshua at waetech.com
Fri Oct 8 16:56:20 CEST 2004


> -----Original Message-----
> From: Tony Meyer [mailto:tameyer at ihug.co.nz] 
> Sent: Thursday, October 07, 2004 6:10 PM
> 
> So you could have something like:
> 
> sb_filter.py -d "C:\Documents and 
> Settings\{username}\Application 
> Data\SpamBayes\default_bayes_database.db" < spam1.mai

Tony,

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):
  File "C:\sb\scripts\sb_filter.py", line 257, in ?
    main()
  File "C:\sb\scripts\sb_filter.py", line 245, in main
    mbox = mboxutils.getmbox(fname)
  File "C:\Python23\Lib\site-packages\spambayes\mboxutils.py", line 66, in
getmbox
    return [get_message(sys.stdin)]
  File "C:\Python23\Lib\site-packages\spambayes\mboxutils.py", line 127, in
get_message
    obj = obj.read()
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!

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.  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.

Now I get this error:

Traceback (most recent call last):
  File "C:\sb\scripts\sb_filter.py", line 257, in ?
    main()
  File "C:\sb\scripts\sb_filter.py", line 245, in main
    mbox = mboxutils.getmbox(fname)
  File "C:\Python23\Lib\site-packages\spambayes\mboxutils.py", line 72, in
getmbox
    mh = mhlib.MH()
  File "C:\Python23\lib\mhlib.py", line 107, in __init__
    if not os.path.isdir(path): raise Error, 'MH() path not found'
mhlib.Error: MH() path not found

I looked in mhlib.py and I see that lines 106 and 107 are as follows:

106   path = os.path.expanduser(path)
107   if not os.path.isdir(path): raise Error, 'MH() path not found'

That made me think perhaps it was a problem with running Python on Windows.
So I grabbed and installed Mark Hammonds Win32 Extensions.  Didn't fix it...

Any thoughts?

<><><><><><><><><><>
Joshua Olson
Web Application Engineer
WAE Tech Inc.
http://www.waetech.com/service_areas/
706.210.0168 




More information about the Spambayes mailing list