Issue #16829: IDLE printing no longer fails if there are spaces or other
authorSerhiy Storchaka <storchaka@gmail.com>
Sat, 12 Jan 2013 16:12:27 +0000 (18:12 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Sat, 12 Jan 2013 16:12:27 +0000 (18:12 +0200)
special characters in the file path.

Lib/idlelib/IOBinding.py
Misc/NEWS

index e429c100ba39a326b9f260a9bba70512fcbc39c5..8078c3f4b76c7283b8de8ed70dedb0c23e8c0638 100644 (file)
@@ -7,6 +7,7 @@
 
 import os
 import types
+import pipes
 import sys
 import codecs
 import tempfile
@@ -503,7 +504,7 @@ class IOBinding:
         else: #no printing for this platform
             printPlatform = False
         if printPlatform:  #we can try to print for this platform
-            command = command % filename
+            command = command % pipes.quote(filename)
             pipe = os.popen(command, "r")
             # things can get ugly on NT if there is no printer available.
             output = pipe.read().strip()
index 43cfc64f71b11637c74de49457615ee9dd5bf4c6..b69e70c492ebb3783504e44d9f666f889ee1b5f4 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -186,6 +186,9 @@ Core and Builtins
 Library
 -------
 
+- Issue #16829: IDLE printing no longer fails if there are spaces or other
+  special characters in the file path.
+
 - Issue #13899: \A, \Z, and \B now correctly match the A, Z, and B literals
   when used inside character classes (e.g. '[\A]').  Patch by Matthew Barnett.