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

@ -106,8 +106,7 @@ def bind_port(sock, host='', preferred_port=54321):
(err, msg) = e
if err != errno.EADDRINUSE:
raise
print >>sys.__stderr__, \
' WARNING: failed to listen on port %d, trying another' % port
print(' WARNING: failed to listen on port %d, trying another' % port, file=sys.__stderr__)
raise TestFailed, 'unable to find port to listen on'
FUZZ = 1e-6
@ -178,10 +177,9 @@ else:
except UnicodeEncodeError:
pass
else:
print \
'WARNING: The filename %r CAN be encoded by the filesystem. ' \
print('WARNING: The filename %r CAN be encoded by the filesystem. ' \
'Unicode filename tests may not be effective' \
% TESTFN_UNICODE_UNENCODEABLE
% TESTFN_UNICODE_UNENCODEABLE)
# Make sure we can write to TESTFN, try in /tmp if we can't
fp = None
@ -194,8 +192,8 @@ except IOError:
TESTFN = TMP_TESTFN
del TMP_TESTFN
except IOError:
print ('WARNING: tests will fail, unable to write to: %s or %s' %
(TESTFN, TMP_TESTFN))
print(('WARNING: tests will fail, unable to write to: %s or %s' %
(TESTFN, TMP_TESTFN)))
if fp is not None:
fp.close()
unlink(TESTFN)
@ -267,7 +265,7 @@ def open_urlresource(url):
return open(fn)
requires('urlfetch')
print >> get_original_stdout(), '\tfetching %s ...' % url
print('\tfetching %s ...' % url, file=get_original_stdout())
fn, _ = urllib.urlretrieve(url, filename)
return open(fn)
@ -514,7 +512,7 @@ def run_doctest(module, verbosity=None):
finally:
sys.stdout = save_stdout
if verbose:
print 'doctest (%s) ... %d tests with zero failures' % (module.__name__, t)
print('doctest (%s) ... %d tests with zero failures' % (module.__name__, t))
return f, t
#=======================================================================