[Tutor] Saving session in IDLE
alan.gauld@bt.com
alan.gauld@bt.com
Mon, 12 Aug 2002 12:04:38 +0100
One of my tutor 'students' has asked me an interesting
question.
How do you Save Session in IDLE?
You can save your current shell window as a text file
and edit it to remove '>>> ' plus output lines etc.
But that's messy.
It would indeed be convenient to save an entire
interactive session such that you could resume later
where you left off.
Two approaches seem feasible:
1) The good way - save the internal state - builtins dir
and all imports etc but this sounds like it's a lot easier
to say/write than to do!
2) The dirty approach - save the session window then
on strip out extraneous lines. This becomes harder if
the lines are continuations using '\' but otherwise
should be possible. The resultant file can then be
imported and the previous session replayed. There's
a snag if the previous session had faults - and
which interactive session doesn't - you stop at the
faulty line. yuck...
Looks like we're back to option 1....
Or does anyone know of a way of doing this already?
Alan g.
Author of the 'Learning to Program' web site
http://www.freenetpages.co.uk/hp/alan.gauld