Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #7139 > unrolled thread

Re: Print Window on IDLE

Started by"Gabriel Genellina" <gagsl-py2@yahoo.com.ar>
First post2011-06-07 03:22 -0300
Last post2011-06-07 03:22 -0300
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Print Window on IDLE "Gabriel Genellina" <gagsl-py2@yahoo.com.ar> - 2011-06-07 03:22 -0300

#7139 — Re: Print Window on IDLE

From"Gabriel Genellina" <gagsl-py2@yahoo.com.ar>
Date2011-06-07 03:22 -0300
SubjectRe: Print Window on IDLE
Message-ID<mailman.2522.1307427593.9059.python-list@python.org>
En Mon, 06 Jun 2011 14:48:26 -0300, Steve Oldner <Steven.Oldner@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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web