From be19ed77ddb047e02fe94d142181062af6d99dcc Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Fri, 9 Feb 2007 05:37:30 +0000 Subject: 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.) --- Lib/pydoc.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'Lib/pydoc.py') diff --git a/Lib/pydoc.py b/Lib/pydoc.py index c496d1dd6f..63bd2f7c38 100755 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -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 ... Show text documentation on something. 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 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() -- cgit v1.2.1