[Spambayes] [spambayes-dev] tte.py not working with zodb - no spam/ham counts

skip at pobox.com skip at pobox.com
Fri Jun 30 05:03:23 CEST 2006


    Tony> As far as I can see contrib/tte.py just uses the standard
    Tony> classifier interface ("learn", "unlearn", "spamprob"), right?

    skip> Yes.  I don't do anything fancy in that regard.  Do I need to do
    skip> some sort of explicit commit (or a close operation that does the
    skip> commit for me)?

Looking at the dir() of a store object, I saw

    ['ClassifierClass', 'DB', '__class__', '__delattr__', '__dict__',
    '__doc__', '__getattr__', '__getattribute__', '__hash__', '__init__',
    '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__',
    '__setattr__', '__str__', '__weakref__', 'classifier', 'close',
    'closed', 'conn', 'create_storage', 'db_filename', 'db_name', 'load',
    'mode', 'storage', 'store']

which suggested tte.py should be calling store.close() in addition to or
instead of store.store().  I tried adding a store.close() call after the
store.store() call, but it didn't make any difference.  I can manually add
hams to the store:

    >>> from spambayes import storage
    >>> dbname, usedb = storage.database_type([])
    >>> store = storage.open_storage(dbname, usedb)
    >>> store.classifier
    <spambayes.storage._PersistentClassifier object at 0x12ad230>
    >>> store.classifier.nham
    0
    >>> store.load()
    >>> store.classifier.nham
    0
    >>> store.learn(["hello"], False)
    >>> store.classifier.nham
    1
    >>> ^D
    % spamcounts -o Storage:persistent_use_database:zodb -o Storage:persistent_storage_file:hammie.db -r hello
    token,nspam,nham,spam prob
    hello,0,1,0.155172413793

Any suggestions for things to try?

Skip


More information about the SpamBayes mailing list