Ok, then I think I can state that sb_filter does work with such files. I took an mbox file containing a single spam message, stripped it of its From_ line and fed it to sb_filter.py on stdin. Worked as intended:
% sb_filter.py < spam.1.eml | egrep Spam X-Spambayes-Classification: spam; 0.93 X-Spambayes-Evidence: '*H*': 0.01; '*S*': 0.88; 'response.': 0.09;
Was there more you needed it to do?
Well I know most of you guys are probably *nix people...I'm on windoze. Maybe my command line syntax isn't right As I said in the OP, if I run sb_filter and paste the text of the email in, it works. If I type sb_filter < mail.eml I get: Z:\>sb_filter.py < mail.eml C:\Python26\lib\site-packages\spambayes\classifier.py:43: DeprecationWarning: the sets module is deprecated from sets import Set Traceback (most recent call last): File "c:\python26\scripts\sb_filter.py", line 257, in <module> main() File "c:\python26\scripts\sb_filter.py", line 245, in main mbox = mboxutils.getmbox(fname) File "c:\python26\Lib\site-packages\spambayes\mboxutils.py", line 66, in getmbox return [get_message(sys.stdin)] File "c:\python26\Lib\site-packages\spambayes\mboxutils.py", line 127, in get_ message obj = obj.read() IOError: [Errno 9] Bad file descriptor The python scripts directory is in the path variable. Mail.eml is in the current directory, and it makes no difference if I supply the full path to mail.eml Thanks for any help. I love spambayes, It's been working awesome for years, but hate MS Exchange. I'd really love to get this working with hMailServer as I've built a great hammie.db that catches 99% of spam. I wrote the script needed to integrate SB with the hMailServer, but I can't seem to get this command line working. Once I do that I'll be home free and spam free once again. Thanks, Mike
Hi Mike,
If I type
sb_filter < mail.eml
I get [...] IOError: [Errno 9] Bad file descriptor
Try this: python sb_filter.py < mail.eml Depending on how you have your file extensions set up, Windows can fail to do redirection properly with the sort of command line you have there. -- Richie Hindle richie@entrian.com
Try this:
python sb_filter.py < mail.eml
Depending on how you have your file extensions set up, Windows can fail to do redirection properly with the sort of command line you have there.
That didn't work, but this did: python c:\python26\scripts\sb_filter.py < mail.eml Thanks! Odd since c:\python26\scripts\ is in my path env and I swear I tried this but apparently not. But now I see yet another problem which may make all this moot. Using a new hammie.db, I can train and filter using the command line above. I was using the pop proxy before. I assumed the hammie.db could be used directly with sb_filter, but I get an error if I replace the new hammie.db with the old one from the proxy setup: Traceback (most recent call last): File "c:\python26\scripts\sb_filter.py", line 257, in <module> main() File "c:\python26\scripts\sb_filter.py", line 248, in main action(msg) File "c:\python26\scripts\sb_filter.py", line 179, in filter self.open('r') File "c:\python26\scripts\sb_filter.py", line 163, in open self.h = hammie.open(self.dbname, self.usedb, self.mode) File "c:\python26\Lib\site-packages\spambayes\hammie.py", line 267, in open return Hammie(storage.open_storage(filename, useDB, mode)) File "c:\python26\Lib\site-packages\spambayes\storage.py", line 710, in open_storage return klass(data_source_name) File "c:\python26\Lib\site-packages\spambayes\storage.py", line 91, in __init__ self.load() File "c:\python26\Lib\site-packages\spambayes\storage.py", line 114, in load tempbayes = pickle.load(fp) EOFError The SB versions might be different that the pop proxy I was using. Did anything in the DB change structure over the past 3 years or so? Or are they just not compatible? I thought I had the pop proxy configured for pickle. Thanks! -Mike
>> ... I get an error if I replace the new hammie.db with the old one >> from the proxy setup: ... >> File "c:\python26\Lib\site-packages\spambayes\storage.py", line 114, in load >> tempbayes = pickle.load(fp) >> EOFError >> The SB versions might be different that the pop proxy I was >> using. Did anything in the DB change structure over the past 3 years >> or so? I suspect the default database type might have changed. Make sure you specify a SpamBayes INI file with the proper settings. >> Or are they just not compatible? I thought I had the pop proxy >> configured for pickle. Maybe not. -- Skip Montanaro - skip@pobox.com - http://www.smontanaro.net/ "XML sucks, dictionaries rock" - Dave Beazley
Just wanted to thank everyone for their help. Turns out the hammie I had was not a pickle. After telling sb_filter that, it worked great. I have hMailServer up and running adding spambayes headers to the emails as they come in. Thanks! -Mike
participants (3)
-
digital tuning, inc. -
Richie Hindle -
skip@pobox.com