Python Forum
save a session in idle - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: save a session in idle (/thread-41052.html)



save a session in idle - akbarza - Nov-05-2023

hi
suppose I am learning Python in idle. I want to save this session because I want to work on it for later(suppose I want to back to it tomorrow or some hours later).
is there any way to save this session in idle?
thanks


RE: save a session in idle - Larz60+ - Nov-05-2023

Have you looked at the menus?


RE: save a session in idle - deanhystad - Nov-05-2023

What do you mean by "save this session"?

You can save a program/script file and use the file at a later time. You can save variable values to a file and restore them (json, pickle). I know of no way to save the current state of an interactive python interpreter.


RE: save a session in idle - akbarza - Nov-06-2023

(Nov-05-2023, 11:38 AM)Larz60+ Wrote: Have you looked at the menus?

hi and thanks
I looked and explored the menu bar at idle, but I did not find anything.


RE: save a session in idle - akbarza - Nov-06-2023

(Nov-05-2023, 03:24 PM)deanhystad Wrote: What do you mean by "save this session"?

You can save a program/script file and use the file at a later time. You can save variable values to a file and restore them (json, pickle). I know of no way to save the current state of an interactive python interpreter.

hi
you said:
Quote:save the current state of an interactive python interpreter.
I want this. suppose I am learning Python with idle. in idle I write some functions and variables and import commands and....
I want these for the next time that I continue to learn ( after lunch Smile ). With the turn of the computer, I will lose them. What can I do to have them for the next session of my learning? ( Note: I have turned off the computer)
thanks


RE: save a session in idle - snippsat - Nov-06-2023

ptpython and IPython save all history that typed in a interactive session.
IPython can just use arrow keys(up down) to get earlier code or print all with In [1]: %history -g.
ptpython is most advance Checking Code History and Reinserting Earlier Code.
[Image: UUn5AX.png]
[Image: IeHTrT.png]