diff -r bddbaaf332d7 Lib/idlelib/IOBinding.py --- a/Lib/idlelib/IOBinding.py Fri Jan 11 19:29:43 2013 -0800 +++ b/Lib/idlelib/IOBinding.py Sat Jan 12 15:55:38 2013 +0530 @@ -1,4 +1,6 @@ import os +import subprocess +import shlex import types import sys import codecs @@ -452,23 +454,26 @@ if platform == 'posix': #posix platform command = idleConf.GetOption('main','General', 'print-command-posix') - command = command + " 2>&1" elif platform == 'nt': #win32 platform command = idleConf.GetOption('main','General','print-command-win') else: #no printing for this platform printPlatform = False if printPlatform: #we can try to print for this platform command = command % filename - pipe = os.popen(command, "r") - # things can get ugly on NT if there is no printer available. - output = pipe.read().strip() - status = pipe.close() - if status: - output = "Printing failed (exit status 0x%x)\n" % \ - status + output - if output: - output = "Printing command: %s\n" % repr(command) + output - tkMessageBox.showerror("Print status", output, master=self.text) + splitted_cmd = shlex.split(command) + try: + # things can get ugly on NT if there is no printer available. + output = subprocess.check_call(splitted_cmd, stderr + = subprocess.STDOUT) + except subprocess.CalledProcessError as exc: + output = "Printing failed (exit status {:#x})\n{}".format( + exc.returncode, exc.output) + output = output.strip() + if output: + output = "Printing command: %s\n%s" %\ + (" ".join(map(shlex.quote, splitted_cmd)), output) + tkMessageBox.showerror("Print status", output, + master=self.text) else: #no printing for this platform message = "Printing is not enabled for this platform: %s" % platform tkMessageBox.showinfo("Print status", message, master=self.text) diff -r bddbaaf332d7 Misc/ACKS --- a/Misc/ACKS Fri Jan 11 19:29:43 2013 -0800 +++ b/Misc/ACKS Sat Jan 12 15:55:38 2013 +0530 @@ -43,6 +43,7 @@ Jérémy Anger Jon Anglin Heidi Annexstad +Ramchandra Apte Éric Araujo Alicia Arlen Jason Asbahr