[Spambayes] mysql and pgsql
Mike Miskulin
mmm at projectumbra.org
Sun Feb 19 18:55:55 CET 2006
Hi,
This probably should go to the devloper list, but I don't want to step
on anyones toes. Having
recently suffered db corruption and desiring to gain even minimal
experience with pgsql and
mysql I decided to give these options a go with a fresh db. Many hours
I can note the following
items - (perhaps some have already been fixed in the latest CVS). All
items are reference
to the 1.1a1 source on win XP with python 2.4
In the file storage.py there appear to be a number of issues:
Around abouts line 550 within class mySQLClassifier(SQLClassifier) section,
there is the line:
elif info.startswith("pass")
self.username = info[5:]
this is in error, it should be self.password
Around about line 454 in the class PGClassifier(SQLClassifier) section,
all the code to gather the host,user,pass and db name are ommited, ie
stuff like
self.username = etc, basically the same stuff from the mySQL section
That said, while I appear to now be ok (initially at least) with mySQL,
attempts
to use pgSQL still fail. The db is initially set up, but things fail
about line 380
in storage.py when a message is trained, specifically with this:
c.execute("select * from bayes"
" where word=%s",
(word,))
Additionally, through my bumbling about with all this and trying to
retrain on messages,
I was getting an error in classifier.py regarding division by zero,
about line 320 where
it calculates probability (forwhatever reason hamratio and spamratio
were coming up 0).
For my purposes I added a simple test to check for this before the
calcuation which is
probably a reasonable thing to have anyways.
Lastly, can you add a line to your FAQ in regards the mySQL/pgSQL usuage
and how
to modifiy the bayescustomize.ini to handle username/password. I looked
and looked
forever until stumbling on an email from quite a while ago where the
format was revealed.
Er.. very lastly, for some reason I also needed to add psycopg to an
environmental variable
to get past an import error. This really baffled me (I'm not a python
user until now) as I was
able to type from a dos shell in the spambayes directory python and
then import psycopg
with no error message, et spambayes always failed. I'm sure this has to
be related to my
cluelessness about things python and spambayes :)
Thanks again for all your hard work. I don't know if this is helpful or
not, but would
appreciate any feedback in regards the pgsql and spambayes.
Cheers
More information about the SpamBayes
mailing list