Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #15294
| Date | 2011-11-03 09:58 -0500 |
|---|---|
| From | Brandon Harris <brandon.harris@reelfx.com> |
| Subject | Re: Python Pickling Issue |
| References | <4EB2A840.5060108@reelfx.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2407.1320332334.27778.python-list@python.org> (permalink) |
After digging around a while I discovered I was attempting to pickle a
third party class that can't be pickled. Initially I was removing it
before pickling and everything was kosher, but at some point it got back
onto the class. Apologies.
Brandon L. Harris
On 11/03/2011 09:42 AM, Brandon Harris wrote:
> I have written a fairly large DAG with python and I've run into an
> issue when attempting to pickle the data to disk.
> It will pickle fine the first time, but if I call pickle again, it
> throws this error.
>
> /usr/lib64/python2.6/copy_reg.py in _reduce_ex(self, proto)
> 68 else:
> 69 if base is self.__class__:
> ---> 70 raise TypeError, "can't pickle %s objects" %
> base.__name__
> 71 state = base(self)
> 72 args = (self.__class__, base, state)
>
> TypeError: can't pickle function objects
>
> I'm calling
> save_file = open('my_file.rsf', 'w')
> cPickle.dump(self, save_file)
>
> I have attempted to pickle the object to a different file after the
> first time, but the error is still thrown.
>
> This wouldn't be very hard to track down if the error gave any
> indication as to where or what this function it can't pickle is, so
> if there's any possible way to at least get the name of what's failing
> to be pickled, that would be a win.
>
> Thanks in advance for all replies.
>
> Brandon L. Harris
>
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Python Pickling Issue Brandon Harris <brandon.harris@reelfx.com> - 2011-11-03 09:58 -0500
csiph-web