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.)
This commit is contained in:
Guido van Rossum 2007-02-09 05:37:30 +00:00
parent 452bf519a7
commit be19ed77dd
331 changed files with 2567 additions and 2648 deletions

View file

@ -1165,8 +1165,8 @@ def _demo_posix():
# Example 1: Simple redirection: Get process list
#
plist = Popen(["ps"], stdout=PIPE).communicate()[0]
print "Process list:"
print plist
print("Process list:")
print(plist)
#
# Example 2: Change uid before executing child
@ -1178,42 +1178,42 @@ def _demo_posix():
#
# Example 3: Connecting several subprocesses
#
print "Looking for 'hda'..."
print("Looking for 'hda'...")
p1 = Popen(["dmesg"], stdout=PIPE)
p2 = Popen(["grep", "hda"], stdin=p1.stdout, stdout=PIPE)
print repr(p2.communicate()[0])
print(repr(p2.communicate()[0]))
#
# Example 4: Catch execution error
#
print
print "Trying a weird file..."
print()
print("Trying a weird file...")
try:
print Popen(["/this/path/does/not/exist"]).communicate()
print(Popen(["/this/path/does/not/exist"]).communicate())
except OSError as e:
if e.errno == errno.ENOENT:
print "The file didn't exist. I thought so..."
print "Child traceback:"
print e.child_traceback
print("The file didn't exist. I thought so...")
print("Child traceback:")
print(e.child_traceback)
else:
print "Error", e.errno
print("Error", e.errno)
else:
print >>sys.stderr, "Gosh. No error."
print("Gosh. No error.", file=sys.stderr)
def _demo_windows():
#
# Example 1: Connecting several subprocesses
#
print "Looking for 'PROMPT' in set output..."
print("Looking for 'PROMPT' in set output...")
p1 = Popen("set", stdout=PIPE, shell=True)
p2 = Popen('find "PROMPT"', stdin=p1.stdout, stdout=PIPE)
print repr(p2.communicate()[0])
print(repr(p2.communicate()[0]))
#
# Example 2: Simple execution of program
#
print "Executing calc..."
print("Executing calc...")
p = Popen("calc")
p.wait()