Persistence

Fernando Pérez fperez528 at yahoo.com
Thu Apr 11 20:30:12 EDT 2002


Chris Liechti wrote:

> Rajarshi Guha <rxg218 at psu.edu> wrote in
> news:a94qk5$22mg at r02n01.cac.psu.edu:
> 
>> On Thursday 11 April 2002 13:58 in comp.lang.python Riccardo de Maria
>> wrote:
>> 
>>> Is there a way to save in a file the status, objects, functions of
>>> interpreter
>>> in order to restore it after the interpreter has been closed?
>>> 
>>> If it is possible, one can work on a project stop and then continue
>>> later adding functions, objects and so on.
> 
> thats a question for an IDE with such functionality. i don't know one but i
> think it should be easy to store all objects in the global namespace of the
> interpreter and load it again on next startup.
> the textual history of the interpreter with all the outputs must be saved
> separately.
> 

well, I've tried (not terribly hard) and failed. My ipython project is a fancy 
interpreter (http://www-hep.colorado.edu/~fperez/ipython/) and I wanted 
exactly that kind of functionality. It turns out pickle cant quite pickle 
_everything_ you throw at it, so there's bound to be things in your 
namespaces that you can't pickle.

I'd like to know if there's a way to make this work, because as I said my 
first attempts didn't get me anywhere. My kludgy semi-solution was to 
implement session logging/restore by replaying all input, but that's slow, 
error prone and has many other limitations.

Cheers,

f.



More information about the Python-list mailing list