[spambayes-dev] Windows implementation using Command
line(forSpamBayes)
Rob McEwen
webmaster at powerviewsystems.com
Wed Jul 14 15:59:20 CEST 2004
RE: [spambayes-dev] Windows implementation using Command line(forSpamBayes)
Thanks to everyone for their suggestions. I've made much progress so far.
But MORE assistance is needed...
(1) I create a bayescustomize.ini file in the root of the project.
(2) I discovered that the scripts would not run unless I copied the
particular script from the script folder to the base folder. Was that
correct? If so, should I have deleted the original file for that script
which I left in the scripts folder? (When I attempted to run the script from
the scripts folder, I got an error message saying that stuff was not found.)
(3) I then created custom folders and referenced these in the
bayescustomize.ini file which currently looks like this:
******
[Storage]
persistent_storage_file: C:\SpamBayesServerEdition\sb_storage\sb_BayesDB.db
messageinfo_storage_file:
C:\SpamBayesServerEdition\sb_storage\sb_MessageDB.db
spam_cache: C:\SpamBayesServerEdition\sb_cache_spam
ham_cache: C:\SpamBayesServerEdition\sb_cache_ham
unknown_cache: C:\SpamBayesServerEdition\sb_cache_unknown
****** (but without the asterisks)
(4) At a command line, cued to the proper directory, I successfully ran
"sb_filter.py -n" The database file was created successfully.
(5) Next, I copied some spam and ham messages from my server to the proper
folders.
(6) At first sb_mboxtrain.py didn't work. It turns out, various assumptions
existed which didn't apply in my case. The closest function, as far as I
could tell, was the "maildir_train" function for "maildir" -type mail boxes.
But even this wasn't compatible. My mail was simply a collection of text
files in a folder. It didn't follow "maildir" conventions. Therefore, I had
to rem out the following lines:
# REM:
# shutil.copystat(cfn, tfn)
# XXX: This will raise an exception on Windows. Do any Windows
# people actually use Maildirs?
# REM:
# shutil.copystat(cfn, tfn)
# REM:
# os.rename(tfn, cfn)
# REM:
# if (removetrained):
# os.unlink(cfn)
(I hope that these were not important!!! ...Are they?)
Also, I made some other modifications regarding the path. Also, I'm assuming
here that (a) "cfn" is important, but (b) "tfn" is arbitrary. Again, is that
true?
Now, when I run:
"sb_mboxtrain.py -s C:\SpamBayesServerEdition\sb_train_as_spam"
it SEEMS to work. It gives me the proper success message, and the date/time
stamp on the database updates.
(but I wish I could KNOW for sure that it worked. Could I be getting a false
positive?)
(7) This is where I am stuck. When I actually attempt to run a file through
the filter, I've used the following:
"sb_filter.py -f
C:\SpamBayesServerEdition\inbox\20040624105403D1E2-00000002.tmp"
(file name from my mail server)
It returns with NO feedback and NO errors. Therefore, I started placing
"print" statements in various parts of the code to see what actually gets
processed. It never seems to get past the following line:
for fname in args:
print "fname: " % fname
(notice my print line I eventually added. When this print line is place
here, an error message occurs:
File "C:\SpamBayesServerEdition\sb_filter.py", line 247, in main print
"fname: " % fname
TypeError: not all arguments converted during string formatting"
(note that the line number I report may be different than yours because of
modifications I've made)
Any suggestions? Was my command well formed?
Rob McEwen
PowerView Systems
rob at PowerViewSystems.com
(478) 475-9032
More information about the spambayes-dev
mailing list