Pickling a dictionary

Ian Kelly ian.g.kelly at gmail.com
Wed Nov 7 11:16:34 EST 2012


On Wed, Nov 7, 2012 at 9:07 AM, Devashish Tyagi
<devashishrocker at gmail.com> wrote:
> So I want to store the current state of a InteractiveInterpreter Object in database. In order to achieve this I tried this
>
> obj = InteractiveInterpreter()
> local = obj.locals()
> pickle.dump(local, open('obj.dump','rw'))
>
> But I received an error say
> TypeError: can't pickle ellipsis objects
>
> From what I understand this shouldn't occur as local is a dictionary. Any particular reason for this behaviour?

The contents of the dictionary need to be pickleable as well.  You
probably have an ellipsis object in the dict somewhere.



More information about the Python-list mailing list