Mercurial > cpython-lru_cache-weakref
diff Lib/idlelib/PyShell.py @ 40775:4cdf21a0dbbc
Fix most trivially-findable print statements.
There's one major and one minor category still unfixed:
doctests are the major category (and I hope to be able to augment the
refactoring tool to refactor bona fide doctests soon);
other code generating print statements in strings is the minor category.
(Oh, and I don't know if the compiler package works.)
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Fri, 09 Feb 2007 05:37:30 +0000 |
| parents | 6b18a095c2e7 |
| children | 04f5cbc74424 |
line wrap: on
line diff
--- a/Lib/idlelib/PyShell.py Fri Feb 09 05:32:43 2007 +0000 +++ b/Lib/idlelib/PyShell.py Fri Feb 09 05:37:30 2007 +0000 @@ -19,8 +19,8 @@ try: from Tkinter import * except ImportError: - print>>sys.__stderr__, "** IDLE can't import Tkinter. " \ - "Your Python may not be configured for Tk. **" + print("** IDLE can't import Tkinter. " \ + "Your Python may not be configured for Tk. **", file=sys.__stderr__) sys.exit(1) import tkMessageBox @@ -504,14 +504,14 @@ console = self.tkconsole.console if how == "OK": if what is not None: - print >>console, repr(what) + print(repr(what), file=console) elif how == "EXCEPTION": if self.tkconsole.getvar("<<toggle-jit-stack-viewer>>"): self.remote_stack_viewer() elif how == "ERROR": errmsg = "PyShell.ModifiedInterpreter: Subprocess ERROR:\n" - print >>sys.__stderr__, errmsg, what - print >>console, errmsg, what + print(errmsg, what, file=sys.__stderr__) + print(errmsg, what, file=console) # we received a response to the currently active seq number: try: self.tkconsole.endexecuting() @@ -576,8 +576,8 @@ except (OverflowError, SyntaxError): self.tkconsole.resetoutput() tkerr = self.tkconsole.stderr - print>>tkerr, '*** Error in script or command!\n' - print>>tkerr, 'Traceback (most recent call last):' + print('*** Error in script or command!\n', file=tkerr) + print('Traceback (most recent call last):', file=tkerr) InteractiveInterpreter.showsyntaxerror(self, filename) self.tkconsole.showprompt() else: @@ -730,8 +730,7 @@ if use_subprocess: # When run w/o subprocess, both user and IDLE errors # are printed here; skip message in that case. - print >> self.tkconsole.stderr, \ - "IDLE internal error in runcode()" + print("IDLE internal error in runcode()", file=self.tkconsole.stderr) self.showtraceback() if use_subprocess: self.tkconsole.endexecuting() @@ -1349,7 +1348,7 @@ if os.path.isfile(script): pass else: - print "No script file: ", script + print("No script file: ", script) sys.exit() enable_shell = True if o == '-s':
