[Spambayes] FAQ: 4.18 How do I use a pickle for storage?
Skip Montanaro
skip at pobox.com
Mon Jul 12 14:22:32 CEST 2004
>> I'm trying to setup Spambayes on my Mac OS X 10.3. I just installed
>> Python 2.3 which I just downloaded.
Tony> [bsddb not available]
Tony> Hmm. I thought that bsddb was included with all versions of 2.3,
Tony> including the one that Apple bundles with Jaguar. I could easily
Tony> be wrong, though. I've cc'd this to Skip, because I believe he
Tony> would know the answer to that (and might otherwise miss this
Tony> message). Skip?
Apple's Python does indeed have bsddb, but it's the old, evil 1.85 thing
that Spambayes won't use:
% PYTHONSTARTUP= /usr/bin/python -S
Python 2.2 (#1, 07/14/02, 23:25:09)
[GCC Apple cpp-precomp 6.14] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import bsddb
>>> dir(bsddb)
['__doc__', '__file__', '__name__', 'btopen', 'error', 'hashopen', 'rnopen']
(Note the very minimal API with just the *open functions.)
You will not get the new non-evil bsddb package when installing Python
unless you've already installed an acceptable version of Berkeley DB (>= 3.3
I think), though you may get bsddb185. I use fink so have it via that. You
can download and install it from sleepycat.com though.
Tony> You can still use a pickle, although you're right that this makes
Tony> it difficult to do that! (We'll have to address that at some
Tony> point). You'll need to create a "bayescustomize.ini" or
Tony> ".spambayesrc" file yourself and put in it:
Tony> [Storage]
Tony> persistent_use_database:pickle
Tony> (without the leading spaces). The tricky thing is where to put
Tony> it. Again, Skip would know this better than me stuck here on my
Tony> Windows machine. I suspect that calling it ".spambayesrc" and
Tony> putting it in your Home directory would work, but I might be
Tony> wrong.
You can put it anywhere you like as long as you have a BAYESCUSTOMIZE
environment variable that refers to it, e.g.:
BAYESCUSTOMIZE=$HOME/hammie.opt ; export BAYESCUSTOMIZE
Skip
More information about the Spambayes
mailing list