cPickle problems

Jeff Poole korvus at gmail.com
Thu Nov 16 19:48:29 EST 2006


To clutter this up with yet another message, this is what happens if I
use pickle instead of cPickle.  Same error, but it has more of a stack
trace so someone more advanced than myself might be able to pick out
what is going amiss.

Traceback (most recent call last):
  File "./generateTools.py", line 50, in ?
    proj.findVHDLfiles("vhd")
  File "/cygdrive/c/fpga/tools/FPGAProject.py", line 631, in
findVHDLfiles
    cpickle.dump(filenameToClassDic,pickleFile,PICKLE_FILE_PROTOCOL)
  File "/usr/lib/python2.4/pickle.py", line 1382, in dump
    Pickler(file, protocol, bin).dump(obj)
  File "/usr/lib/python2.4/pickle.py", line 231, in dump
    self.save(obj)
  File "/usr/lib/python2.4/pickle.py", line 293, in save
    f(self, obj) # Call unbound method with explicit self
  File "/usr/lib/python2.4/pickle.py", line 663, in save_dict
    self._batch_setitems(obj.iteritems())
  File "/usr/lib/python2.4/pickle.py", line 677, in _batch_setitems
    save(v)
  File "/usr/lib/python2.4/pickle.py", line 338, in save
    self.save_reduce(obj=obj, *rv)
  File "/usr/lib/python2.4/pickle.py", line 433, in save_reduce
    save(state)
  File "/usr/lib/python2.4/pickle.py", line 293, in save
    f(self, obj) # Call unbound method with explicit self
  File "/usr/lib/python2.4/pickle.py", line 663, in save_dict
    self._batch_setitems(obj.iteritems())
  File "/usr/lib/python2.4/pickle.py", line 677, in _batch_setitems
    save(v)
  File "/usr/lib/python2.4/pickle.py", line 293, in save
    f(self, obj) # Call unbound method with explicit self
  File "/usr/lib/python2.4/pickle.py", line 614, in save_list
    self._batch_appends(iter(obj))
  File "/usr/lib/python2.4/pickle.py", line 629, in _batch_appends
    save(x)
  File "/usr/lib/python2.4/pickle.py", line 293, in save
    f(self, obj) # Call unbound method with explicit self
  File "/usr/lib/python2.4/pickle.py", line 576, in save_tuple
    save(element)
  File "/usr/lib/python2.4/pickle.py", line 338, in save
    self.save_reduce(obj=obj, *rv)
  File "/usr/lib/python2.4/pickle.py", line 433, in save_reduce
    save(state)
  File "/usr/lib/python2.4/pickle.py", line 293, in save
    f(self, obj) # Call unbound method with explicit self
  File "/usr/lib/python2.4/pickle.py", line 663, in save_dict
    self._batch_setitems(obj.iteritems())
  File "/usr/lib/python2.4/pickle.py", line 677, in _batch_setitems
    save(v)
  File "/usr/lib/python2.4/pickle.py", line 313, in save
    rv = reduce(self.proto)
  File "/usr/lib/python2.4/copy_reg.py", line 83, in _reduce_ex
    dict = getstate()
TypeError: 'str' object is not callable


Jeff  Poole wrote:
> Oh, and I suppose I should provide some version information:
>
> $ python
> Python 2.4.3 (#1, May 18 2006, 07:40:45)
> [GCC 3.3.3 (cygwin special)] on cygwin
>
>
> Jeff  Poole wrote:
> > This is going to be a pretty vague message because it involves a large
> > block of code I'd rather avoid posting.  Basically, I've been pickling
> > a dictionary of instances of a class I've created (which contains
> > references to other instances of other classes).  At some point in the
> > last few weeks, pickling has stopped working with the following error:
> >
> > Traceback (most recent call last):
> >   File "./generateTools.py", line 50, in ?
> >     proj.findVHDLfiles("vhd")
> >   File "/cygdrive/c/fpga/tools/FPGAProject.py", line 630, in
> > findVHDLfiles
> >     cpickle.dump(filenameToClassDic,pickleFile,PICKLE_FILE_PROTOCOL)
> >   File "/usr/lib/python2.4/copy_reg.py", line 83, in _reduce_ex
> >     dict = getstate()
> > TypeError: 'str' object is not callable
> >
> >
> > Does anyone have any idea why this might be failing in this way?  It's
> > driving me crazy.  If need be I can probably provide the code to the
> > class, though it's about 1000 lines, most of which is PyParsing code.
> > I appreciate any help you guys can provide.
> > 
> > 
> > Jeff




More information about the Python-list mailing list