This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2011年04月12日 18:03 by terry.reedy, last changed 2022年04月11日 14:57 by admin.
| Messages (9) | |||
|---|---|---|---|
| msg133592 - (view) | Author: Terry J. Reedy (terry.reedy) * (Python committer) | Date: 2011年04月12日 18:03 | |
One can currently save the contents of a shell window exactly as is, with opening message, prompts, and restarts. This essentially a screenshot of the frame -- fine for an IDLE doc but not useful for rerunning the code. Similarly, if one pastes in interactive input/output, with or without secondary prompts, into an edit window, it is a nuisance to edit. This issue proposes an option to 'flip' code and output lines, with prompts deleted and outputs commented, so that Python 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> 1+2 3 becomes #Python 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit (Intel)] on win32 #Type "copyright", "credits" or "license()" for more information. 1+2 #3 (Ignore linewrap artifact on first line). |
|||
| msg148781 - (view) | Author: Terry J. Reedy (terry.reedy) * (Python committer) | Date: 2011年12月02日 23:34 | |
Roger Serway pointed me to the PastePyShell.py extension that is part of the IdleX package http://idlex.sourceforge.net/ That does the conversion when *pasting* interpreter text into an edit window. I would have File/Save do the same thing when saving the shell text to a .py file. |
|||
| msg148783 - (view) | Author: Roger Serwy (roger.serwy) * (Python committer) | Date: 2011年12月03日 00:38 | |
I considered saving directly from the shell but then I ran into a use-case problem. Saving the shell window as an runnable script will also save any syntax errors that were entered. A user would then have to open an editor to correct these errors. A high-level task analysis would be as follows: With "Save As Runnable", the user needs to save, open, and then fix. With "Paste from Shell", the user needs to copy, paste, and then fix. If you have suggestions for handling shell errors, I'm open to them. |
|||
| msg148786 - (view) | Author: Terry J. Reedy (terry.reedy) * (Python committer) | Date: 2011年12月03日 05:56 | |
Either way, it would be nice to have erroneous commands flagged or filtered. That can be detected when the first line of output is Traceback (most recent call last): I typically would copy, correct, and rerun a line until I get it correct, so I would want bad lines just removed. Others might prefer otherwise. I should take a look at your extension when I get a chance. |
|||
| msg148947 - (view) | Author: Roger Serwy (roger.serwy) * (Python committer) | Date: 2011年12月07日 01:32 | |
This issue relates to #1178 A traceback does not necessarily mean that the last statement had the error. For example: >>> a = lambda: 1/0 >>> a() Traceback (most recent call last): File "<pyshell#1>", line 1, in <module> a() File "<pyshell#0>", line 1, in <lambda> a = lambda: 1/0 ZeroDivisionError: integer division or modulo by zero I suppose that the specification should be extended such that the above to get transformed to: a = lambda: 1/0 #ERROR>>> a() # #Traceback (most recent call last): #.... or something similar. Thoughts? |
|||
| msg148949 - (view) | Author: Terry J. Reedy (terry.reedy) * (Python committer) | Date: 2011年12月07日 03:20 | |
Interesting example. This issue is a bit more complicated than I thought. Clearly, the call that reveals an error in previous lines should not be simply deleted. |
|||
| msg215870 - (view) | Author: Terry J. Reedy (terry.reedy) * (Python committer) | Date: 2014年04月10日 11:12 | |
#21140 is about saving Output Window (renamed) as .txt instead of .py. Same method should be used to save shell log as .txt. My idea is that File menu for shell window should, if possible, have both Save as log Save as runnable code |
|||
| msg402691 - (view) | Author: Terry J. Reedy (terry.reedy) * (Python committer) | Date: 2021年09月27日 05:49 | |
This should be easier to do with the new shell with indents fixed. |
|||
| msg402694 - (view) | Author: Terry J. Reedy (terry.reedy) * (Python committer) | Date: 2021年09月27日 06:31 | |
In #45297, Steven D'Aprano suggests deleting code immediately followed by traceback. (SyntaxErrors should not be there at all -- another issue.) But should NameError, for instance, be ignore, just because user printed something? Or block removed just because it comes before print statement? Without more feedback, I believe most would want all code actually run. If there is a Traceback, Add comment with error and message. UI is a tough issue. I don't want to add more File menu entries and hot keys. We can add to shell context menu as have already done. Maybe this: after getting the save name, branch on type: .py, code only; anything else, full log. Subsequent ^S saves use last save-as name to decide. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:16 | admin | set | github: 56047 |
| 2021年09月27日 06:31:28 | terry.reedy | set | messages: + msg402694 |
| 2021年09月27日 05:51:23 | terry.reedy | set | priority: normal -> high |
| 2021年09月27日 05:49:26 | terry.reedy | set | nosy:
- tlesher, roger.serwy messages: + msg402691 versions: + Python 3.11, - Python 3.6, Python 3.7 |
| 2017年06月30日 00:59:13 | terry.reedy | set | assignee: terry.reedy versions: + Python 3.6, Python 3.7, - Python 2.7, Python 3.4, Python 3.5 |
| 2014年04月10日 11:12:47 | terry.reedy | set | messages: + msg215870 |
| 2014年04月09日 21:36:33 | terry.reedy | set | type: enhancement versions: + Python 2.7, Python 3.4, Python 3.5, - Python 3.3 |
| 2011年12月07日 03:20:56 | terry.reedy | set | messages: + msg148949 |
| 2011年12月07日 01:32:13 | roger.serwy | set | messages: + msg148947 |
| 2011年12月03日 05:56:34 | terry.reedy | set | messages: + msg148786 |
| 2011年12月03日 00:38:50 | roger.serwy | set | messages: + msg148783 |
| 2011年12月02日 23:34:31 | terry.reedy | set | messages: + msg148781 |
| 2011年12月02日 07:21:06 | roger.serwy | set | nosy:
+ roger.serwy |
| 2011年06月14日 12:38:19 | tlesher | set | nosy:
+ tlesher |
| 2011年04月15日 17:05:57 | eric.araujo | set | nosy:
+ eric.araujo title: IDLE: make interactive code runnable. -> IDLE: make interactive code savable as a runnable script |
| 2011年04月12日 18:03:08 | terry.reedy | create | |