On Wed, Nov 7, 2012 at 9:16 AM, Ian Kelly <ian.g.ke...@gmail.com> wrote: > On Wed, Nov 7, 2012 at 9:07 AM, Devashish Tyagi > <devashishroc...@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.
By the way, if you use Python 3 and pickle protocol 3, then Ellipsis *is* pickleable: Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:55:48) [MSC v.1600 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import pickle >>> pickle.dumps(Ellipsis, protocol=pickle.HIGHEST_PROTOCOL) b'\x80\x03cbuiltins\nEllipsis\nq\x00.' Cheers, Ian -- http://mail.python.org/mailman/listinfo/python-list