Re: Pickling a dictionary

2012-11-07 Thread Ian Kelly
On Wed, Nov 7, 2012 at 10:40 AM, Devashish Tyagi wrote: > Here is the code > > from code import InteractiveInterpreter > import StringIO > import pickle > > src = StringIO.StringIO() > inter = InteractiveInterpreter() > inter.runcode('a = 5') > local = inter.locals > > pickle.dump(local,open('obj.

Re: Pickling a dictionary

2012-11-07 Thread Devashish Tyagi
On Wednesday, 7 November 2012 21:57:05 UTC+5:30, Peter Otten wrote: > Devashish Tyagi 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 = o

Re: Pickling a dictionary

2012-11-07 Thread Ian Kelly
On Wed, Nov 7, 2012 at 9:16 AM, Ian Kelly wrote: > On Wed, Nov 7, 2012 at 9:07 AM, Devashish Tyagi > 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(

Re: Pickling a dictionary

2012-11-07 Thread Peter Otten
Devashish Tyagi 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')) Assuming InteractiveInterpreter is imported

Re: Pickling a dictionary

2012-11-07 Thread Ian Kelly
On Wed, Nov 7, 2012 at 9:07 AM, Devashish Tyagi 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 rec

Pickling a dictionary

2012-11-07 Thread Devashish Tyagi
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 wh