[Tutor] Saving session in IDLE
Gregor Lingl
glingl@aon.at
Mon, 12 Aug 2002 13:35:51 +0200
alan.gauld@bt.com schrieb:
>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.
>
>
Ideed could be useful!
>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 - ... There's
>a snag if the previous session had faults - and
>which interactive session doesn't - you stop at the
>faulty line. yuck...
>
This could possibly be caught by a try: ... except: ... clause.
Nonetheless I think, you couldn't do it without a Python-parser. How
would you otherwise manage to process the following fancy input (+ output):
>>> print " ",(1,
3,
7); print " Hello"
(1, 3, 7)
Hello
>>>
>
>Looks like we're back to option 1....
>
>Or does anyone know of a way of doing this already?
>
>
Equally interested
Gregor