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

@ -1480,7 +1480,7 @@ def doc(thing, title='Python Library Documentation: %s', forceload=0):
desc += ' object'
pager(title % desc + '\n\n' + text.document(object, name))
except (ImportError, ErrorDuringImport) as value:
print value
print(value)
def writedoc(thing, forceload=0):
"""Write HTML documentation to a file in the current directory."""
@ -1490,9 +1490,9 @@ def writedoc(thing, forceload=0):
file = open(name + '.html', 'w')
file.write(page)
file.close()
print 'wrote', name + '.html'
print('wrote', name + '.html')
except (ImportError, ErrorDuringImport) as value:
print value
print(value)
def writedocs(dir, pkgpath='', done=None):
"""Write out HTML documentation for all modules in a directory tree."""
@ -1883,7 +1883,7 @@ def apropos(key):
def callback(path, modname, desc):
if modname[-9:] == '.__init__':
modname = modname[:-9] + ' (package)'
print modname, desc and '- ' + desc
print(modname, desc and '- ' + desc)
try: import warnings
except ImportError: pass
else: warnings.filterwarnings('ignore') # ignore problems during import
@ -2200,9 +2200,9 @@ def cli():
except ValueError:
raise BadUsage
def ready(server):
print 'pydoc server ready at %s' % server.url
print('pydoc server ready at %s' % server.url)
def stopped():
print 'pydoc server stopped'
print('pydoc server stopped')
serve(port, ready, stopped)
return
if opt == '-w':
@ -2211,7 +2211,7 @@ def cli():
if not args: raise BadUsage
for arg in args:
if ispath(arg) and not os.path.exists(arg):
print 'file %r does not exist' % arg
print('file %r does not exist' % arg)
break
try:
if ispath(arg) and os.path.isfile(arg):
@ -2224,11 +2224,11 @@ def cli():
else:
help.help(arg)
except ErrorDuringImport as value:
print value
print(value)
except (getopt.error, BadUsage):
cmd = os.path.basename(sys.argv[0])
print """pydoc - the Python documentation tool
print("""pydoc - the Python documentation tool
%s <name> ...
Show text documentation on something. <name> may be the name of a
@ -2251,6 +2251,6 @@ def cli():
Write out the HTML documentation for a module to a file in the current
directory. If <name> contains a '%s', it is treated as a filename; if
it names a directory, documentation is written for all the contents.
""" % (cmd, os.sep, cmd, cmd, cmd, cmd, os.sep)
""" % (cmd, os.sep, cmd, cmd, cmd, cmd, os.sep))
if __name__ == '__main__': cli()