Print Window on IDLE
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Tue Jun 7 02:22:44 EDT 2011
En Mon, 06 Jun 2011 14:48:26 -0300, Steve Oldner <Steven.Oldner at la.gov>
escribió:
> Seems to work using 2.7 but not 3.2. On 3.2 it just closes all my
> python sessions. Is this a bug? Can someone point me to a "How To" on
> using a local printer in windows?
It's a bug. Starting IDLE from the command line, one can actually see the
error:
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'
IDLE is attempting to read an entry from its configuration file, but fails
because of a syntax error in the file (it's an error for a ConfigParser
entry, %s should be %%s). The same entry was fine for earlier IDLE
versions. As a workaround, you may edit the offending lines in your
configuration file.
Go to the idlelib directory; if you don't know where it is, just open idle
or Python command line and execute:
py> import idlelib
py> idlelib.__file__
'D:\\apps\\python32\\lib\\idlelib\\__init__.py'
In the same directory you'll find config-main.def; open it, and replace
these lines in the [General] section:
print-command-posix=lpr %%s
print-command-win=start /min notepad /p %%s
(%s should become %%s). Tested on Windows, but Linux should have the same
problem and temporary solution. You may need to roll this change back when
the code is corrected.
Reported as http://bugs.python.org/issue12274
--
Gabriel Genellina
More information about the Python-list
mailing list