diff --git a/FWCore/GuiBrowsers/python/DOTExport.py b/FWCore/GuiBrowsers/python/DOTExport.py index e7a2bc3d9a851..e2261ca571aac 100644 --- a/FWCore/GuiBrowsers/python/DOTExport.py +++ b/FWCore/GuiBrowsers/python/DOTExport.py @@ -1,3 +1,4 @@ +from __future__ import print_function import sys import os import logging @@ -483,7 +484,7 @@ def export(self,data,filename,filetype): dot = self.dotIndenter(dot) self.write_output(dot,filename,filetype) else: - print "WARNING: Empty image. Not saved." + print("WARNING: Empty image. Not saved.") def get_png_size(self,filename): @@ -502,7 +503,7 @@ def write_output(self,dot,filename,filetype): dotfile.write(dot) dotfile.close() elif filetype=='stdout': - print result + print(result) elif filetype=='pdf': dot_p = subprocess.Popen(['dot','-Tps2'],stdin=subprocess.PIPE,stdout=subprocess.PIPE) ps2 = dot_p.communicate(dot)[0] @@ -526,7 +527,7 @@ def write_output(self,dot,filename,filetype): mapfile.close() filesize = self.get_png_size('%s.png'%filename) if max(filesize) > self.options['png_max_size']: - print "png image is too large (%s pixels/%s max pixels), deleting" % (filesize,self.options['png_max_size']) + print("png image is too large (%s pixels/%s max pixels), deleting" % (filesize,self.options['png_max_size'])) os.remove('%s.png'%filename) os.remove('%s.map'%filename) elif filetype=='png': @@ -536,7 +537,7 @@ def write_output(self,dot,filename,filetype): raise "dot returned non-zero exit code: %s"%dot_p.returncode filesize = self.get_png_size(filename) if max(filesize) > self.options['png_max_size']: - print "png image is too large (%s pixels/%s max pixels), deleting" % (filesize,self.options['png_max_size']) + print("png image is too large (%s pixels/%s max pixels), deleting" % (filesize,self.options['png_max_size'])) os.remove(filename) else: dot_p = subprocess.Popen(['dot','-T%s'%(filetype),'-o',filename],stdin=subprocess.PIPE) diff --git a/FWCore/GuiBrowsers/python/EnablePSetHistory.py b/FWCore/GuiBrowsers/python/EnablePSetHistory.py index 176a5ec3ad19e..5c5d5b42f56f7 100644 --- a/FWCore/GuiBrowsers/python/EnablePSetHistory.py +++ b/FWCore/GuiBrowsers/python/EnablePSetHistory.py @@ -1,3 +1,4 @@ +from __future__ import print_function from copy import deepcopy import inspect import six @@ -112,7 +113,7 @@ def new_dumpHistory(self,withImports=True): if isinstance(item,(str,unicode)): dumpHistory.append(item +"\n") else: # isTool - print item + print(item) dump=item.dumpPython() if isinstance(dump,tuple): if withImports and dump[0] not in dumpHistory: diff --git a/FWCore/GuiBrowsers/python/Vispa/Plugins/ConfigEditor/ConfigDataAccessor.py b/FWCore/GuiBrowsers/python/Vispa/Plugins/ConfigEditor/ConfigDataAccessor.py index aa479bffb6927..6548db9ed88b9 100644 --- a/FWCore/GuiBrowsers/python/Vispa/Plugins/ConfigEditor/ConfigDataAccessor.py +++ b/FWCore/GuiBrowsers/python/Vispa/Plugins/ConfigEditor/ConfigDataAccessor.py @@ -1,3 +1,4 @@ +from __future__ import print_function import sys import os.path import logging @@ -254,7 +255,7 @@ def setProcess(self,process): for path in entry: self._readRecursive(folder, path) if True: - print "Creating schedule...", + print("Creating schedule...", end=' ') self.readConnections(self.allChildren(folders["modules"])) self._scheduleRecursive(folders["paths"]) self._scheduledObjects.reverse() @@ -267,7 +268,7 @@ def setProcess(self,process): folders["paths"]._configChildren.remove(scheduled_folder) folders["paths"]._configChildren.insert(0,scheduled_folder) scheduled_folder._configChildren=self._scheduledObjects - print "done" + print("done") else: self._scheduledObjects=self._allObjects diff --git a/FWCore/GuiBrowsers/python/Vispa/Plugins/ConfigEditor/ConfigEditorTabController.py b/FWCore/GuiBrowsers/python/Vispa/Plugins/ConfigEditor/ConfigEditorTabController.py index e90efb9278a6f..32f5db63feb22 100644 --- a/FWCore/GuiBrowsers/python/Vispa/Plugins/ConfigEditor/ConfigEditorTabController.py +++ b/FWCore/GuiBrowsers/python/Vispa/Plugins/ConfigEditor/ConfigEditorTabController.py @@ -1,4 +1,5 @@ from __future__ import absolute_import +from __future__ import print_function import sys import logging import os.path @@ -302,7 +303,7 @@ def readFile(self, filename): if self.plugin().application().commandLineOptions().saveimage: self.tab().centerView().updateConnections() self.saveImage(self.plugin().application().commandLineOptions().saveimage) - print "Saved image to", self.plugin().application().commandLineOptions().saveimage, "." + print("Saved image to", self.plugin().application().commandLineOptions().saveimage, ".") sys.exit(2) return True return False diff --git a/FWCore/GuiBrowsers/python/Vispa/Share/UndoEvent.py b/FWCore/GuiBrowsers/python/Vispa/Share/UndoEvent.py index f7bd3d3a9cab5..77a87ceec8e04 100644 --- a/FWCore/GuiBrowsers/python/Vispa/Share/UndoEvent.py +++ b/FWCore/GuiBrowsers/python/Vispa/Share/UndoEvent.py @@ -1,3 +1,4 @@ +from __future__ import print_function class UndoEvent(object): LABEL = "" @@ -45,7 +46,7 @@ def isLastSavedState(self): return False def dump(self, prefix="undo"): - print prefix, ": ", self.LABEL, self.isLastSavedState() + print(prefix, ": ", self.LABEL, self.isLastSavedState()) class MultiUndoEvent(UndoEvent): diff --git a/FWCore/GuiBrowsers/python/Vispa/Views/PropertyView.py b/FWCore/GuiBrowsers/python/Vispa/Views/PropertyView.py index 3bdff1930e49f..c2ebb2fe63a4e 100644 --- a/FWCore/GuiBrowsers/python/Vispa/Views/PropertyView.py +++ b/FWCore/GuiBrowsers/python/Vispa/Views/PropertyView.py @@ -1,3 +1,4 @@ +from __future__ import print_function import logging import sys import os.path @@ -313,7 +314,7 @@ def valueChanged(self, property): if result==True: self.emit(SIGNAL('valueChanged'),property.name(), newvalue, oldValue, property.categoryName()) else: - print "valueChanged() result = ", result, type(result) + print("valueChanged() result = ", result, type(result)) property.setToolTip(result) QMessageBox.critical(self.parent(), 'Error', result) bad=True diff --git a/FWCore/GuiBrowsers/test/dotbatch.py b/FWCore/GuiBrowsers/test/dotbatch.py index 640b45f0bf9d9..23a2e2fa05846 100644 --- a/FWCore/GuiBrowsers/test/dotbatch.py +++ b/FWCore/GuiBrowsers/test/dotbatch.py @@ -1,5 +1,6 @@ #!/usr/bin/env python +from __future__ import print_function import os import sys from optparse import OptionParser @@ -31,7 +32,7 @@ def verbose(msg): if options.verbose: - print msg + print(msg) presets = { 'tag':{'endpath':False,'source':False,'legend':False}, diff --git a/FWCore/GuiBrowsers/test/htmlbatch.py b/FWCore/GuiBrowsers/test/htmlbatch.py index 055fa50370251..17bbd0d3f71c9 100644 --- a/FWCore/GuiBrowsers/test/htmlbatch.py +++ b/FWCore/GuiBrowsers/test/htmlbatch.py @@ -1,5 +1,6 @@ #!/usr/bin/env python +from __future__ import print_function import os import sys from optparse import OptionParser @@ -23,7 +24,7 @@ def verbose(msg): if options.verbose: - print msg + print(msg) parser = OptionParser(usage="Usage: %prog [options] file0_cfg.py file1_cfg.py...") diff --git a/FWCore/GuiBrowsers/test/testAll.py b/FWCore/GuiBrowsers/test/testAll.py index a4147599ca4e1..179df77a9b6cc 100755 --- a/FWCore/GuiBrowsers/test/testAll.py +++ b/FWCore/GuiBrowsers/test/testAll.py @@ -1,4 +1,5 @@ #! /usr/bin/env python +from __future__ import print_function import unittest import os.path import sys @@ -13,16 +14,16 @@ for dir in dirs: dirList = [os.path.abspath(os.path.join(dir, f)) for f in os.listdir(dir)] dirs += [d for d in dirList if os.path.isdir(d) and not os.path.basename(d).startswith(".")] - print "scanning directories:" + print("scanning directories:") for dir in dirs: - print os.path.basename(dir) + print(os.path.basename(dir)) sys.path.append(dir) tests += [f[: - 3] for f in os.listdir(dir) if f.startswith("test") and f.endswith(".py")] - print "---" - print "running tests:" + print("---") + print("running tests:") for test in sorted(tests): - print test - print "---" + print(test) + print("---") for test in sorted(tests): exec("from " + str(test) + " import *") unittest.main() diff --git a/FWCore/GuiBrowsers/test/testGui.py b/FWCore/GuiBrowsers/test/testGui.py index 47a8930f72bf9..50fa4b5c56685 100755 --- a/FWCore/GuiBrowsers/test/testGui.py +++ b/FWCore/GuiBrowsers/test/testGui.py @@ -1,4 +1,5 @@ #! /usr/bin/env python +from __future__ import print_function import unittest import os.path import sys @@ -9,16 +10,16 @@ if __name__ == "__main__": tests = [] dirs = [os.path.abspath(os.path.join(os.path.dirname(__file__),"Gui"))] - print "scanning directories:" + print("scanning directories:") for dir in dirs: - print os.path.basename(dir) + print(os.path.basename(dir)) sys.path.append(dir) tests += [f[: - 3] for f in os.listdir(dir) if f.startswith("test") and f.endswith(".py")] - print "---" - print "running tests:" + print("---") + print("running tests:") for test in sorted(tests): - print test - print "---" + print(test) + print("---") for test in sorted(tests): exec("from " + str(test) + " import *") unittest.main() diff --git a/FWCore/GuiBrowsers/test/testMain.py b/FWCore/GuiBrowsers/test/testMain.py index 5676465eaeb83..494c336c12597 100755 --- a/FWCore/GuiBrowsers/test/testMain.py +++ b/FWCore/GuiBrowsers/test/testMain.py @@ -1,4 +1,5 @@ #! /usr/bin/env python +from __future__ import print_function import unittest import os.path import sys @@ -9,16 +10,16 @@ if __name__ == "__main__": tests = [] dirs = [os.path.abspath(os.path.join(os.path.dirname(__file__),"Main"))] - print "scanning directories:" + print("scanning directories:") for dir in dirs: - print os.path.basename(dir) + print(os.path.basename(dir)) sys.path.append(dir) tests += [f[: - 3] for f in os.listdir(dir) if f.startswith("test") and f.endswith(".py")] - print "---" - print "running tests:" + print("---") + print("running tests:") for test in sorted(tests): - print test - print "---" + print(test) + print("---") for test in sorted(tests): exec("from " + str(test) + " import *") unittest.main() diff --git a/FWCore/GuiBrowsers/test/testPluginConfigEditor.py b/FWCore/GuiBrowsers/test/testPluginConfigEditor.py index 3c34871ffc85b..9616d43e66238 100755 --- a/FWCore/GuiBrowsers/test/testPluginConfigEditor.py +++ b/FWCore/GuiBrowsers/test/testPluginConfigEditor.py @@ -1,4 +1,5 @@ #! /usr/bin/env python +from __future__ import print_function import unittest import os.path import sys @@ -9,16 +10,16 @@ if __name__ == "__main__": tests = [] dirs = [os.path.abspath(os.path.join(os.path.dirname(__file__),"Plugins","ConfigEditor"))] - print "scanning directories:" + print("scanning directories:") for dir in dirs: - print os.path.basename(dir) + print(os.path.basename(dir)) sys.path.append(dir) tests += [f[: - 3] for f in os.listdir(dir) if f.startswith("test") and f.endswith(".py")] - print "---" - print "running tests:" + print("---") + print("running tests:") for test in sorted(tests): - print test - print "---" + print(test) + print("---") for test in sorted(tests): exec("from " + str(test) + " import *") unittest.main() diff --git a/FWCore/GuiBrowsers/test/testPluginEdmBrowser.py b/FWCore/GuiBrowsers/test/testPluginEdmBrowser.py index a36185e6b97fa..db8ebf90d99e1 100755 --- a/FWCore/GuiBrowsers/test/testPluginEdmBrowser.py +++ b/FWCore/GuiBrowsers/test/testPluginEdmBrowser.py @@ -1,4 +1,5 @@ #! /usr/bin/env python +from __future__ import print_function import unittest import os.path import sys @@ -9,16 +10,16 @@ if __name__ == "__main__": tests = [] dirs = [os.path.abspath(os.path.join(os.path.dirname(__file__),"Plugins","EdmBrowser"))] - print "scanning directories:" + print("scanning directories:") for dir in dirs: - print os.path.basename(dir) + print(os.path.basename(dir)) sys.path.append(dir) tests += [f[: - 3] for f in os.listdir(dir) if f.startswith("test") and f.endswith(".py")] - print "---" - print "running tests:" + print("---") + print("running tests:") for test in sorted(tests): - print test - print "---" + print(test) + print("---") for test in sorted(tests): exec("from " + str(test) + " import *") unittest.main() diff --git a/FWCore/GuiBrowsers/test/testShare.py b/FWCore/GuiBrowsers/test/testShare.py index f836e073da722..bed63bd861cb3 100755 --- a/FWCore/GuiBrowsers/test/testShare.py +++ b/FWCore/GuiBrowsers/test/testShare.py @@ -1,4 +1,5 @@ #! /usr/bin/env python +from __future__ import print_function import unittest import os.path import sys @@ -9,16 +10,16 @@ if __name__ == "__main__": tests = [] dirs = [os.path.abspath(os.path.join(os.path.dirname(__file__),"Share"))] - print "scanning directories:" + print("scanning directories:") for dir in dirs: - print os.path.basename(dir) + print(os.path.basename(dir)) sys.path.append(dir) tests += [f[: - 3] for f in os.listdir(dir) if f.startswith("test") and f.endswith(".py")] - print "---" - print "running tests:" + print("---") + print("running tests:") for test in sorted(tests): - print test - print "---" + print(test) + print("---") for test in sorted(tests): exec("from " + str(test) + " import *") unittest.main() diff --git a/FWCore/GuiBrowsers/test/testViews.py b/FWCore/GuiBrowsers/test/testViews.py index 2737a46a493f5..de5b41804cf69 100755 --- a/FWCore/GuiBrowsers/test/testViews.py +++ b/FWCore/GuiBrowsers/test/testViews.py @@ -1,4 +1,5 @@ #! /usr/bin/env python +from __future__ import print_function import unittest import os.path import sys @@ -9,16 +10,16 @@ if __name__ == "__main__": tests = [] dirs = [os.path.abspath(os.path.join(os.path.dirname(__file__),"Views"))] - print "scanning directories:" + print("scanning directories:") for dir in dirs: - print os.path.basename(dir) + print(os.path.basename(dir)) sys.path.append(dir) tests += [f[: - 3] for f in os.listdir(dir) if f.startswith("test") and f.endswith(".py")] - print "---" - print "running tests:" + print("---") + print("running tests:") for test in sorted(tests): - print test - print "---" + print(test) + print("---") for test in sorted(tests): exec("from " + str(test) + " import *") unittest.main()