[Spambayes] hammie's dbm file has changed
Tim Stone - Four Stones Expressions
tim@fourstonesExpressions.com
Mon Nov 18 02:52:49 2002
Here's a diff between hammie 1.38 and 1.39
cvs diff -r 1.38 -r 1.39 hammie.py (in directory C:\sourceforge\spambayes\)
Index: hammie.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/hammie.py,v
retrieving revision 1.38
retrieving revision 1.39
diff -r1.38 -r1.39
13c13
< Can be specified more than once.
---
> Can be specified more than once, or use - for stdin.
16c16
< Can be specified more than once.
---
> Can be specified more than once, or use - for stdin.
42a43
> import types
112,113c113,120
< if self.hash.has_key(key):
< return pickle.loads(self.hash[key])
---
> v = self.hash[key]
> if v[0] == 'W':
> val = pickle.loads(v[1:])
> # We could be sneaky, like pickle.Unpickler.load_inst,
> # but I think that's overly confusing.
> obj = classifier.WordInfo(0)
> obj.__setstate__(val)
> return obj
115c122
< raise KeyError(key)
---
> return pickle.loads(v)
118c125,129
< v = pickle.dumps(val, 1)
---
> if isinstance(val, classifier.WordInfo):
> val = val.__getstate__()
> v = 'W' + pickle.dumps(val, 1)
> else:
> v = pickle.dumps(val, 1)
*****CVS exited normally with code 1*****
- TimS
11/17/2002 8:48:46 PM, Neale Pickett <neale@woozle.org> wrote:
>So then, Ranieri J D Severiano <rjdsnet@yahoo.com> is all like:
>
>> ranieri@uyrapuru:spambayes$ ./hammie.py -s ~/Mail/bulkmail
>> Traceback (most recent call last):
>> File "./hammie.py", line 497, in ?
>> main()
>> File "./hammie.py", line 459, in main
>> bayes = createbayes(pck, usedb, mode)
>> File "./hammie.py", line 401, in createbayes
>> bayes = pickle.load(fp)
>> File "/usr/lib/python2.2/copy_reg.py", line 40, in _reconstructor
>> obj = base.__new__(cls, state)
>> TypeError: ('object.__new__(X): X is not a type object (class)', <function
_reconstructor at 0x8148cd4>, (<class classifier.Bayes at 0x82103b4>, <type
'object'>, None))
>
>Yikes!
>
>I'm pretty sure I didn't change anything that would affect the way
>pickles are stored (they don't use PersistentGrahamBayes or the DBDict
>classes), but it sure does look like *something* has changed for you.
>
>Unfortunately, SF CVS is down for the day, so I can't check to see
>what's changed between those versions.
>
>> >>> from cPickle import load
>> >>> f = open('hammie.db')
>> >>> o = load(f)
>
>Could you try the same thing, importing load from pickle instead? It
>will give a better traceback. I don't know enough yet about how the
>pickling works to be able to diagnose this without some more information
>first.
>
>Neale
>
>_______________________________________________
>Spambayes mailing list
>Spambayes@python.org
>http://mail.python.org/mailman/listinfo/spambayes
>
>
- Tim
www.fourstonesExpressions.com
More information about the Spambayes
mailing list