Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add shell session logging option to IDLE #67854

Open
rhettinger opened this issue Mar 14, 2015 · 7 comments
Open

Add shell session logging option to IDLE #67854

rhettinger opened this issue Mar 14, 2015 · 7 comments
Assignees
Labels
topic-IDLE type-feature A feature request or enhancement

Comments

@rhettinger
Copy link
Contributor

BPO 23666
Nosy @rhettinger, @terryjreedy, @taleinat, @grantjenks

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/terryjreedy'
closed_at = None
created_at = <Date 2015-03-14.23:38:05.303>
labels = ['3.8', 'expert-IDLE', 'type-feature', '3.7', '3.9']
title = 'Add shell session logging option to IDLE'
updated_at = <Date 2019-08-10.07:17:16.532>
user = 'https://github.com/rhettinger'

bugs.python.org fields:

activity = <Date 2019-08-10.07:17:16.532>
actor = 'terry.reedy'
assignee = 'terry.reedy'
closed = False
closed_date = None
closer = None
components = ['IDLE']
creation = <Date 2015-03-14.23:38:05.303>
creator = 'rhettinger'
dependencies = []
files = []
hgrepos = []
issue_num = 23666
keywords = []
message_count = 7.0
messages = ['238109', '238740', '238743', '238745', '302498', '349315', '349334']
nosy_count = 4.0
nosy_names = ['rhettinger', 'terry.reedy', 'taleinat', 'grantjenks']
pr_nums = []
priority = 'normal'
resolution = None
stage = 'test needed'
status = 'open'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue23666'
versions = ['Python 3.7', 'Python 3.8', 'Python 3.9']

@rhettinger
Copy link
Contributor Author

IDLE's interactive shell supports File / Save to save an interactive session. However, if a user restarts a session or accidentally exits without saving, all is lost.

In Python courses I've taught, there has been a recurring request for an auto-logging feature (save the session at some regular interval). This would help user's record everything they type during a Python class.

I suggest an addition to the File menu (for the interactive shell only): Session Logging Enable/Disable.

@rhettinger rhettinger added topic-IDLE type-feature A feature request or enhancement labels Mar 14, 2015
@terryjreedy
Copy link
Member

I do not see how Restart (as opposed to a proposed Clear option) loses anything. However, closing without saving definitely anything since a save. Moreover, even after saving Shell once, there is no Save on Close box displayed (as for editor windows) when closing Shell without saving. This has been discussed somewhere (maybe StackOverflow) but I do not find an issue.

Raymond, would it be sufficient if saving once would mean that one could not close (or clear the window) without being prompted to save again? What if we add timed autosaves bpo-21152 (based on your comment on bpo-21140, msg215485), or autosave (or autoappend) with each prompt?

@rhettinger
Copy link
Contributor Author

Autosave would suffice. :-)

The "restart" issue wasn't the usual restart you get by pressing F5. What is happening is that someone does an action that kills or hangs the IDLE app, then they have to force close and restart IDLE itself.

@terryjreedy
Copy link
Member

Do you know if, when a process is killed, date written to open files gets flushed to disk?

@grantjenks
Copy link
Mannequin

grantjenks mannequin commented Sep 19, 2017

+1 from me. I'd like to see it ask me to save when I close the window if I've already saved once.

@taleinat
Copy link
Contributor

taleinat commented Aug 9, 2019

I'm happy to look into implementing this. Also perhaps auto-saved backups for edited files.

Where would you suggest the files be kept? The user's .idlerc directory?

@terryjreedy
Copy link
Member

A dirty editor must be saved before running, or discarded before closing. Neither is true for Shell, Making these at least an option in Shell should be the first change. If the user has specified a savefile name, that should be used, and the user is responsible for the file. If a file is automatically put, say, in .idlerc/shell.bak.py, there is an issue of when to delete or overwrite.

We should continue working to make automatic, versus explicit, shell logging less necessary.

If IDLE running in normal mode (user code running in a separate process) either closes by itself or locks up so that it *must* be closed, that should indicates a bug in python or IDLE that should be fixed. There might be a couple such bugs left, I am not sure.

If the user process closes, the shell should restart one automatically. As far as I know, it dies.

If the user process hangs, control-C (Shell => Interrupt Execution) usually works,
  >>> while 1: 2+2
  KeyboardInterrupt
  >>> 
But a) beginning computer user may not know about ^C, or it may not work due to limitations in Python.  (There is an issue about the latter.)  In the latter case, one can restart with Shell => Restart Shell, but this is IDLE specific and users may not know about it.

When the shell catches ^C, it could create an after callback with a delay of, say, .5 seconds (but to be determined). If ^C works, cancel the callback. If not, display a message (only once per session) about using Restart. Maybe next time, do an auto restart.

We might also think about detecting a hang (5 seconds, no output?) and printing a message about using ^C.

@terryjreedy terryjreedy added 3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes labels Aug 10, 2019
@terryjreedy terryjreedy self-assigned this Aug 10, 2019
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
@erlend-aasland erlend-aasland removed 3.9 only security fixes 3.8 only security fixes 3.7 (EOL) end of life labels Mar 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-IDLE type-feature A feature request or enhancement
Projects
Status: No status
Development

No branches or pull requests

4 participants