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 2013年06月27日 22:43 by terry.reedy, last changed 2022年04月11日 14:57 by admin.
| Messages (3) | |||
|---|---|---|---|
| msg191966 - (view) | Author: Terry J. Reedy (terry.reedy) * (Python committer) | Date: 2013年06月27日 22:43 | |
It appears that Idle was originally written to run on *nix after being launched from a command-line console. Messages related to Idle code (warnings and exceptions) are sent back to the console, while messages related to user code go to the shell window. This makes Idle a hybrid text/gui application. Later, Idle was ported to run on Windows with the pythonw.exe no-console binary. When it is started normally for Windows, from anything but a console, there is no console. This has caused problems when Idle tries to write to the non-existent console. (I do not know the situation on modern Mac and *nix.) (Even when a console does exist, it will usually get buried and messages may not be seen.) Example: The warning system, monkey patched in both PyShell.py and run.py and documented in the former. (Edited quote from 3.3.) # Override warnings module to write to warning_stream. # Initialize to send IDLE internal warnings to the console. # ScriptBinding.check_syntax() will temporarily redirect the stream # to the shell window to display warnings when checking user's code. warning_stream = sys.__stderr__ # Typically None, at least on Windows. def idle_showwarning(... ... if file is None: file = warning_stream # Which may itself be None!!! try: file.write(... # AttributeError when file is still None except OSError: pass # if file (probably __stderr__) is invalid, skip warning. The patch for #18081 also catches AttributeError as a bandage. Issue goal: make Idle a true gui app by removing the dependence on a console, which may not exist. Proposed method: re-factor Idle startup to try to import tkinter first, rather than last. If this import fails, inform user with console message and/or the os-specific means to gui apps to tell users 'I cannot start because ...'. I know this exists on Windows because I have seen such messages. I presume same is true on other systems. If this import succeeds, setup traceback and warnings hooks to send internal messages to a gui messagebox rather than (or possibly in addition to) a console that may or may not be present. Or send the messages to the Shell window, but marked somehow as internal. The warnings hook might be used after importing non-Idle modules but before importing Idle modules, so startup is not bogged down on debug builds by DeprecationWarnings from non-Idle modules To be a good citizen for testing, all custom hooks should be undone before the PyShell import finishes and before PyShell.main exits (same for run.py). |
|||
| msg192087 - (view) | Author: Roger Serwy (roger.serwy) * (Python committer) | Date: 2013年06月30日 22:00 | |
This looks similar to issue13582 with the patch to redirect console writes to a GUI text box. |
|||
| msg192094 - (view) | Author: Terry J. Reedy (terry.reedy) * (Python committer) | Date: 2013年06月30日 23:53 | |
The proposal here is to flip the roles of text console and graphics gui, rather than to indefinitely bandage the current roles. I would want that even with the patch for #13582 applied (which I hope can be done soon). |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:47 | admin | set | github: 62518 |
| 2020年06月07日 23:27:02 | terry.reedy | set | versions: + Python 3.10, - Python 3.6, Python 3.7 |
| 2017年06月29日 23:33:24 | terry.reedy | set | stage: test needed versions: + Python 3.6, Python 3.7, - Python 2.7, Python 3.3, Python 3.4 |
| 2017年06月19日 20:32:59 | terry.reedy | set | assignee: terry.reedy components: + IDLE |
| 2015年09月18日 16:33:30 | markroseman | set | nosy:
+ markroseman |
| 2013年07月01日 05:42:01 | ggenellina | set | nosy:
+ ggenellina |
| 2013年06月30日 23:53:18 | terry.reedy | set | messages: + msg192094 |
| 2013年06月30日 22:00:04 | roger.serwy | set | messages: + msg192087 |
| 2013年06月27日 22:43:29 | terry.reedy | create | |