Ramchandra Apte added the comment:
Attached is a patch which uses subprocess. Haven't tested it much.
--
Added file: http://bugs.python.org/file28705/issue16829.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16829
Serhiy Storchaka added the comment:
No surrounding %%s with quotes, nor changing to %%r doesn't work in all cases,
because Python and shell use different quoting schemas. The only solution is
using shlex.quote (which available only since 3.3). But even in this case we
should be careful, this
Roundup Robot added the comment:
New changeset e651d96e6b07 by Serhiy Storchaka in branch '2.7':
Issue #16829: IDLE printing no longer fails if there are spaces or other
http://hg.python.org/cpython/rev/e651d96e6b07
New changeset 20065626c0b5 by Serhiy Storchaka in branch '3.2':
Issue #16829:
Serhiy Storchaka added the comment:
I have committed a very simple fix with shlex.quote (pipes.quote before 3.3).
This is not fully backward compatible, it can break user configuration if the
user had fixed this issue himself (and this fix is not perfect). But I
think it's quite unlikely.
Terry J. Reedy added the comment:
Given the system-dependent nature of the problem, starting with the simplest
thing that really ought to work seems reasonable to me. I verified that the 3.3
patch has no effect on Windows. IE, files with and without spaces printed
without .py in the printed
Ramchandra Apte added the comment:
Going to attach a patch using subprocess in a few minutes...
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16829
___
Serhiy Storchaka added the comment:
It is not so easy. The problem is that we have to determine the print command
by configuration line. A user may wish to change these settings, and some users
already changed them. The patch should not break them. For backward
compatibility we also have to
Ramchandra Apte added the comment:
@Serhiy Storchaka
I don't think anybody edits that line anyway.
IMHO, a warning about this change should be enough.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16829
Serhiy Storchaka added the comment:
At least one who want print filenames on non-default printer must edit that
line. In any case we can't break this in a bugfix release.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16829
Roger Serwy added the comment:
@Serhiy
IDLE places its default configuration files within the standard library. Any
upgrade of Python can modify the contents of the standard library. Even if we
do *nothing* to change Lib/idlelib/config-main.def, the next upgrade would
overwrite an end users
Roger Serwy added the comment:
The attached patch changes %%s to %%r. This should handle file names containing
quotes automatically.
Ramchandra's point of using a subprocess instead would fix the issue as well.
That would require changing print_window in Lib/idlelib/IOBinding.py
Terry's
Roger Serwy added the comment:
See also issue12274.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16829
___
___
Python-bugs-list mailing list
Terry J. Reedy added the comment:
Since there is no 'print filename' command on the menu, I am guessing that this
is about 'File/Print Window' where the window is an edit window for a file with
spaces in the name. In any case, on Win7 3.3 this worked fine for 'tem with
space.py' except that
Serhiy Storchaka added the comment:
But then will be problems with filenames containing .
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16829
___
Ramchandra Apte added the comment:
I think if IDLE directly starts lpr directly (subprocess) rather than using a
shell to run it, then this problem won't happen.
--
nosy: +ramchandra.apte
___
Python tracker rep...@bugs.python.org
Roger Serwy added the comment:
I can confirm this bug for POSIX platforms. Changing the lpr command in
config-main.def to quote the filename seems to fix the problem.
print-command-posix=lpr %%s
It might also be a problem on Windows, but I haven't tried it.
--
keywords: +easy
16 matches
Mail list logo