[spambayes-dev] Script to find which db is used
papaDoc
papaDoc at videotron.ca
Tue Jul 29 10:39:35 EDT 2003
Hi,
This is a little script to find out which database is used by pop3proxy
since it is better to avoid using dumbdb. The script is based on a mail
sent by Skip to me.
Lots of people (At least one... i.e. me) did not know which database
they use. This can help them.
Since this is my first python script I have a question
I think this script should be in
c:/a_dir/spambayes/utilities
but how can you import the options from spambayes.Options when your are in
c:/a_dir/spambayes/utilities. For now the script need to be in c:/a_dir
or I get the error
File "C:\Devtools\SPAMBA~1\SPAMBA~1.03\UTILIT~1\checkdb.py", line 9, in ?
from spambayes.Options import options
ImportError: No module named spambayes.Options
So this is the script.
#!/usr/bin/env python
"""
This little script check which database is used to save your data.
This check the database created by pop3proxy for now.
"""
__author__ = "Remi Ricard <papaDoc at videotron.ca>"
__credits__ = "Skip Montanaro, all the Spambayes folk."
from spambayes.Options import options
import dumbdbm
import dbhash
import whichdb
import bsddb3
db = dumbdbm.open("dumbdb", "c")
db["1"] = "1"
db.close()
str = whichdb.whichdb("dumbdb")
print "Dumbdb is available if the return value is not none : %s" % (str)
db = dbhash.open("dbhash", "c")
db["1"] = "1"
db.close()
str = whichdb.whichdb("dbhash")
print "Dbhash is available if the return value is dbhash : %s" % (str)
db = bsddb3.hashopen("bsddb3", "c")
db["1"] = "1"
db.close()
str = whichdb.whichdb("bsddb3")
print "Bsddb3 is available if the return value is dbhash: %s" % (str)
str = whichdb.whichdb("nonexistent.db")
print "A non existent is a : %s" % (str)
print "\n\n"
hammie = options["pop3proxy", "persistent_storage_file"]
str = whichdb.whichdb(hammie)
print "Your storage %s is a : %s" % (hammie, str)
print "\n\n"
More information about the spambayes-dev
mailing list