diff --git a/Database/AthenaPOOL/AthenaPoolCnvSvc/python/ReadAthenaPool.py b/Database/AthenaPOOL/AthenaPoolCnvSvc/python/ReadAthenaPool.py index c52cd8dd49277d0dba632f7b8c8aadc838da9a2b..3e5503f4349d357695052262cda628c0ea575b87 100644 --- a/Database/AthenaPOOL/AthenaPoolCnvSvc/python/ReadAthenaPool.py +++ b/Database/AthenaPOOL/AthenaPoolCnvSvc/python/ReadAthenaPool.py @@ -76,7 +76,7 @@ def _configureReadAthenaPool(): evtloop = getattr(svcMgr, theApp.EventLoop) try: evtloop.EventPrintoutInterval = 10000 - except Exception, err: + except Exception: msg.info('failed suppressing event loop heartbeat. performances might be sub-par... sorry.') pass diff --git a/Database/AthenaPOOL/AthenaPoolUtilities/share/TPCnvTest.py b/Database/AthenaPOOL/AthenaPoolUtilities/share/TPCnvTest.py index 13ef5600186b88e4fafc80fe22e6841003c9f003..b2a1edfb66d841c73a41124c28d4b8069c51287b 100644 --- a/Database/AthenaPOOL/AthenaPoolUtilities/share/TPCnvTest.py +++ b/Database/AthenaPOOL/AthenaPoolUtilities/share/TPCnvTest.py @@ -34,8 +34,8 @@ import os if os.path.exists ('PoolFileCatalog.xml'): os.remove ('PoolFileCatalog.xml') -if (not globals().has_key ('ATLAS_REFERENCE_TAG') and - os.environ.has_key ('ATLAS_REFERENCE_TAG')): +if (not 'ATLAS_REFERENCE_TAG' in globals() and + 'ATLAS_REFERENCE_TAG' in os.environ): ATLAS_REFERENCE_TAG = os.environ['ATLAS_REFERENCE_TAG'] refpaths = [os.environ.get ('ATLAS_REFERENCE_DATA', None), @@ -101,7 +101,7 @@ def checknewvars (output): return l -if not globals().has_key ('get_dumper_fct'): +if not 'get_dumper_fct' in globals(): from PyDumper.Dumpers import get_dumper_fct from AthenaPython import PyAthena class Dumper (PyAthena.Alg): @@ -117,14 +117,14 @@ class Dumper (PyAthena.Alg): if not os.path.exists (self.reffile_name): self.reffile_name = '../' + self.reffile_name - if not os.path.exists (self.reffile_name) and globals().has_key ('ATLAS_REFERENCE_TAG'): + if not os.path.exists (self.reffile_name) and 'ATLAS_REFERENCE_TAG' in globals(): from AthenaCommon.Utils.unixtools import find_datafile r = find_datafile (ATLAS_REFERENCE_TAG) if r: self.reffile_name = os.path.join (r, ATLAS_REFERENCE_TAG, refbase) - if not os.path.exists (self.reffile_name) and globals().has_key ('ATLAS_REFERENCE_TAG'): + if not os.path.exists (self.reffile_name) and 'ATLAS_REFERENCE_TAG' in globals(): self.reffile_name = find_file (os.path.join (ATLAS_REFERENCE_TAG, refbase)) diff --git a/Database/AthenaPOOL/OutputStreamAthenaPool/python/MultipleStreamManager.py b/Database/AthenaPOOL/OutputStreamAthenaPool/python/MultipleStreamManager.py index 907e3f5c58562544dce53e8545762145af88b25c..462a10ecf802cb91c20b1eca4754e5ee6c7df5d0 100644 --- a/Database/AthenaPOOL/OutputStreamAthenaPool/python/MultipleStreamManager.py +++ b/Database/AthenaPOOL/OutputStreamAthenaPool/python/MultipleStreamManager.py @@ -5,6 +5,7 @@ ## ## ## creation: David Cote (May 2008) ## ######################################################## +from __future__ import print_function class AugmentedStreamBase: """This class manages common methods of AugmentedPoolStream and AugmentedByteStream.""" @@ -53,7 +54,7 @@ class AugmentedStreamBase: if self._ItemInList(item,aList): aList.remove(item) else: - print self.Name,": WARNING you asked to remove item '%s' but this item is not present"%item + print(self.Name,": WARNING you asked to remove item '%s' but this item is not present",item) else: raise TypeError("AugmentedPoolStream._RemoveValidItemFromList() does not support item of type %s"%type(item)) return @@ -233,23 +234,23 @@ class AugmentedPoolStream( AugmentedStreamBase ): ######################################### def Print(self): - print "**** AugmentedPoolStream",self.Name,"****" - print "Output file:" - print self.Stream.OutputFile - print "AcceptAlgs:" - print self.Stream.AcceptAlgs - print "RequireAlgs:" - print self.Stream.RequireAlgs - print "VetoAlgs:" - print self.Stream.VetoAlgs - print "OtherAlgs to bookkeep (but not directly used by the Stream):" - print self.OtherAlgs - print "Master prescale:" - print self.GetPrescale() - print "ItemList:" - print self.Stream.ItemList - print "MetaData ItemList:" - print self.Stream.MetadataItemList + print("**** AugmentedPoolStream",self.Name,"****") + print("Output file:") + print(self.Stream.OutputFile) + print("AcceptAlgs:") + print(self.Stream.AcceptAlgs) + print("RequireAlgs:") + print(self.Stream.RequireAlgs) + print("VetoAlgs:") + print(self.Stream.VetoAlgs) + print("OtherAlgs to bookkeep (but not directly used by the Stream):") + print(self.OtherAlgs) + print("Master prescale:") + print(self.GetPrescale()) + print("ItemList:") + print(self.Stream.ItemList) + print("MetaData ItemList:") + print(self.Stream.MetadataItemList) return ############################################## @@ -314,21 +315,21 @@ class AugmentedByteStream( AugmentedStreamBase ): def RemoveMetaDataItem(self, item): pass def Print(self): - print "**** AugmentedByteStream",self.Name,"****" - print "Output file:" - print self.bsOutputSvc.OutputDirectory+self.bsOutputSvc.SimpleFileName - print "AcceptAlgs:" - print self.Stream.AcceptAlgs - print "RequireAlgs:" - print self.Stream.RequireAlgs - print "VetoAlgs:" - print self.Stream.VetoAlgs - print "OtherAlgs to bookkeep (but not directly used by the Stream):" - print self.OtherAlgs - print "Master prescale:" - print self.GetPrescale() - print "ItemList:" - print "Not available for bytestream" + print("**** AugmentedByteStream",self.Name,"****") + print("Output file:") + print(self.bsOutputSvc.OutputDirectory+self.bsOutputSvc.SimpleFileName) + print("AcceptAlgs:") + print(self.Stream.AcceptAlgs) + print("RequireAlgs:") + print(self.Stream.RequireAlgs) + print("VetoAlgs:") + print(self.Stream.VetoAlgs) + print("OtherAlgs to bookkeep (but not directly used by the Stream):") + print(self.OtherAlgs) + print("Master prescale:") + print(self.GetPrescale()) + print("ItemList:") + print("Not available for bytestream") return ############################################################# @@ -413,7 +414,7 @@ class AugmentedRootStream( AugmentedStreamBase ): StreamName = ParentStreamName ) pass except ImportError: - print self.Name,": INFO didn't find AnalysisTools.AnalysisToolsConf in release." + print(self.Name,": INFO didn't find AnalysisTools.AnalysisToolsConf in release.") pass pass @@ -466,7 +467,7 @@ class AugmentedRootStream( AugmentedStreamBase ): pass pass except ImportError: - print self.Name,": INFO didn't find D3PDMakerCoreComps in release." + print(self.Name,": INFO didn't find D3PDMakerCoreComps in release.") pass return @@ -475,7 +476,7 @@ class AugmentedRootStream( AugmentedStreamBase ): """It's not impossible to change the file name after the stream has been created, but I didn't want to write this code unless there's actual need for it. """ - print "**** ERROR: Can't change the name of the output ROOT file! ****" + print("**** ERROR: Can't change the name of the output ROOT file! ****") return # @@ -487,23 +488,23 @@ class AugmentedRootStream( AugmentedStreamBase ): def RemoveMetaDataItem(self, item): pass def Print(self): - print "**** AugmentedRootStream",self.Name,"****" - print "Output file:" - print " " + self.fileName - print "TTree name:" - print " " + self.treeName - print "AcceptAlgs:" - print " " + str( self.Stream.AcceptAlgs ) - print "RequireAlgs:" - print " " + str( self.Stream.RequireAlgs ) - print "VetoAlgs:" - print " " + str( self.Stream.VetoAlgs ) - print "OtherAlgs to bookkeep (but not directly used by the Stream):" - print " " + str( self.OtherAlgs ) - print "Master prescale:" - print " " + str( self.GetPrescale() ) - print "ItemList:" - print " Not available for ROOT (D3PD) stream" + print("**** AugmentedRootStream",self.Name,"****") + print("Output file:") + print(" " + self.fileName) + print("TTree name:") + print(" " + self.treeName) + print("AcceptAlgs:") + print(" " + str( self.Stream.AcceptAlgs )) + print("RequireAlgs:") + print(" " + str( self.Stream.RequireAlgs )) + print("VetoAlgs:") + print(" " + str( self.Stream.VetoAlgs )) + print("OtherAlgs to bookkeep (but not directly used by the Stream):") + print(" " + str( self.OtherAlgs )) + print("Master prescale:") + print(" " + str( self.GetPrescale() )) + print("ItemList:") + print(" Not available for ROOT (D3PD) stream") return def __iadd__( self, configs ): @@ -654,11 +655,11 @@ class MultipleStreamManager: return True def Print(self): - print "**** MultipleStreamManager INFOS ****" - print "Number of streams:", self.nStream + print("**** MultipleStreamManager INFOS ****") + print("Number of streams:", self.nStream) i=0 for Stream in self.StreamList: - print "----------------------- Stream #",i," -----------------------" + print("----------------------- Stream #",i," -----------------------") Stream.Print() i+=1 return diff --git a/Event/ByteStreamCnvSvc/python/WriteByteStream.py b/Event/ByteStreamCnvSvc/python/WriteByteStream.py index d2b267493afb209d5179139067655972bf618a17..cfdca7f9e4cad4a52546b91f94d4dc539114ea0f 100644 --- a/Event/ByteStreamCnvSvc/python/WriteByteStream.py +++ b/Event/ByteStreamCnvSvc/python/WriteByteStream.py @@ -25,7 +25,7 @@ def getStream(type,name): # type check type = type.upper() if not type in ['EVENTSTORAGE','TRANSIENT']: - raise RuntimeError,"unsupported StreamType:%s" % type + raise RuntimeError("unsupported StreamType:%s" % type) # return existing stream if _streamMap.has_key((type,name)): @@ -119,5 +119,5 @@ def getStream(type,name): return StreamBS else: - raise RuntimeError,"unsupported StreamType:%s" % type + raise RuntimeError("unsupported StreamType:%s" % type)