homepage

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.

classification
Title: "Print window" menu on IDLE aborts whole application
Type: behavior Stage: resolved
Components: IDLE Versions: Python 3.2, Python 3.3
process
Status: closed Resolution: fixed
Dependencies: 15392 Superseder:
Assigned To: Nosy List: BreamoreBoy, ggenellina, kbk, lukasz.langa, python-dev, terry.reedy
Priority: normal Keywords:

Created on 2011年06月07日 06:16 by ggenellina, last changed 2022年04月11日 14:57 by admin. This issue is now closed.

Messages (7)
msg137789 - (view) Author: Gabriel Genellina (ggenellina) Date: 2011年06月07日 06:16
On Windows, IDLE closes all open windows and exits completely, without any error message, when selecting the "Print window" menu command.
Starting IDLE from inside a console, one can see the error message:
Exception in Tkinter callback
Traceback (most recent call last):
 File "D:\apps\python32\lib\tkinter\__init__.py", line 1399, in __call__
 return self.func(*args)
 File "D:\apps\python32\lib\idlelib\IOBinding.py", line 453, in print_window
 command = idleConf.GetOption('main','General','print-command-win')
 File "D:\apps\python32\lib\idlelib\configHandler.py", line 245, in GetOption
 type=type, raw=raw)
 File "D:\apps\python32\lib\idlelib\configHandler.py", line 54, in Get
 return self.get(section, option, raw=raw)
 File "D:\apps\python32\lib\configparser.py", line 789, in get
 d)
 File "D:\apps\python32\lib\configparser.py", line 391, in before_get
 self._interpolate_some(parser, option, L, value, section, defaults, 1)
 File "D:\apps\python32\lib\configparser.py", line 440, in _interpolate_some
 "found: %r" % (rest,))
configparser.InterpolationSyntaxError: '%' must be followed by '%' or '(', found
: '%s'
It is trying to read this entry from the config-main.def file:
[General]
print-command-posix=lpr %s
print-command-win=start /min notepad /p %s
For a ConfigParser file, those %s should be %%s instead. Previous IDLE versions (2.7 and 3.1) read the same entry without problem; I suspect they were using a RawConfigParser or processing the entry in a different way.
As a workaround, replacing %s with %%s in config-main.def is enough, until the code gets fixed.
msg137790 - (view) Author: Gabriel Genellina (ggenellina) Date: 2011年06月07日 06:18
Note: There is a much bigger problem here: IDLE should not abort abruptly in such cases, without any error indication.
msg137823 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011年06月07日 13:21
New changeset 0aa3064d1cef by Łukasz Langa in branch '3.2':
#12274: use proper escaping for % in IDLE config.
http://hg.python.org/cpython/rev/0aa3064d1cef
New changeset b410d013e7a8 by Łukasz Langa in branch 'default':
#12274: use proper escaping for % in IDLE config (merged from 3.2).
http://hg.python.org/cpython/rev/b410d013e7a8 
msg137825 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2011年06月07日 13:26
In 3.2 configparser started validating syntax in interpolation-aware parsers by default. I fixed the configuration.
It's unfortunate this configuration error hasn't been caught before in testing. We need a unit test for broken configuration and a change in IDLE so that it doesn't silently crash when configuration is invalid.
msg220036 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014年06月08日 14:59
Can this be closed as a patch has been committed and the unittest framework was created on issue15392 ?
msg220054 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014年06月08日 20:17
This issue needs a unittest test added within the framework. I opened #21696 as a dependency. Since configx.def files can be edited, and, I believe, at least one is intended to be edited, configHandler should perhaps catch exceptions and display in a messagebox. But unless Idle could continue after that, that might wait for the general fix, which is another issue.
msg228257 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014年10月02日 20:56
Closing since the immediate problem has been fixed and there is a reference to this in #21696 
History
Date User Action Args
2022年04月11日 14:57:18adminsetgithub: 56483
2016年10月05日 10:26:41berker.peksagsetstatus: open -> closed
stage: test needed -> resolved
2014年10月02日 20:56:09terry.reedysetresolution: fixed
dependencies: - Idle: test configuration files
messages: + msg228257
2014年06月08日 20:17:25terry.reedysetdependencies: + Idle: test configuration files
messages: + msg220054
2014年06月08日 14:59:01BreamoreBoysetnosy: + terry.reedy, BreamoreBoy
messages: + msg220036
2012年11月18日 23:28:00roger.serwysetdependencies: + Create a unittest framework for IDLE
2011年06月07日 13:26:41lukasz.langasetversions: + Python 3.3
nosy: + kbk

messages: + msg137825

stage: test needed
2011年06月07日 13:21:46python-devsetnosy: + python-dev
messages: + msg137823
2011年06月07日 12:46:18r.david.murraysetnosy: + lukasz.langa
2011年06月07日 06:18:18ggenellinasetmessages: + msg137790
2011年06月07日 06:16:07ggenellinacreate

AltStyle によって変換されたページ (->オリジナル) /