diff --git a/src/plugins/lib/libhtml.py b/src/plugins/lib/libhtml.py index 41d81f385..e583109a5 100644 --- a/src/plugins/lib/libhtml.py +++ b/src/plugins/lib/libhtml.py @@ -26,6 +26,8 @@ # #------------------------------------------------------------------------ +from __future__ import print_function + """ HTML operations. @@ -95,18 +97,6 @@ _START_CLOSE = set([ 'param' ]) -#------------------------------------------------------------------------ -# -# Helper functions. -# -#------------------------------------------------------------------------ - -def print_(line): - """ - Print function - """ - print line - #------------------------------------------------------------------------ # # Html class. @@ -383,7 +373,7 @@ class Html(list): # iterkeys = itervalues = iteritems = __iter__ # - def write(self, method=print_, indent='\t', tabs=''): + def write(self, method=print, indent='\t', tabs=''): """ Output function: performs an insertion-order tree traversal and calls supplied method for each item found. diff --git a/src/plugins/webreport/NarrativeWeb.py b/src/plugins/webreport/NarrativeWeb.py index 235896b0d..21e81265b 100644 --- a/src/plugins/webreport/NarrativeWeb.py +++ b/src/plugins/webreport/NarrativeWeb.py @@ -37,6 +37,8 @@ Narrative Web Page generator. # python modules # #------------------------------------------------------------------------ +from __future__ print_function +from functools import partial import gc import os import sys @@ -1861,7 +1863,7 @@ class BasePage(object): src/plugins/lib/libhtml.py """ - htmlinstance.write(lambda line: of.write(line + '\n')) + htmlinstance.write(partial(print, file=of)) # closes the file self.report.close_file(of) @@ -5640,8 +5642,8 @@ class NavWebReport(Report): try: shutil.copyfile(from_fname, dest) except: - print "Copying error: %s" % sys.exc_info()[1] - print "Continuing..." + print("Copying error: %s" % sys.exc_info()[1]) + print("Continuing...") elif self.warn_dir: WarningDialog( _("Possible destination error") + "\n" + diff --git a/src/plugins/webreport/WebCal.py b/src/plugins/webreport/WebCal.py index a4355e1d3..af2b5bd2d 100644 --- a/src/plugins/webreport/WebCal.py +++ b/src/plugins/webreport/WebCal.py @@ -27,9 +27,12 @@ """ Web Calendar generator. """ + #------------------------------------------------------------------------ # python modules #------------------------------------------------------------------------ +from __future__ import print_function +from functools import partial import os, codecs, shutil, re import datetime, calendar from gen.ggettext import sgettext as _ @@ -1241,7 +1244,7 @@ class WebCalReport(Report): """ # writes the file out from the page variable; Html instance - page.write(lambda line: of.write(line + '\n')) + page.write(partial(print, file=of.write)) # close the file now... self.close_file(of)