From 9ceb4600f1d6c03185df7684c58ab2a11237c666 Mon Sep 17 00:00:00 2001 From: Marko Petric <marko.petric@cern.ch> Date: Thu, 25 Jul 2019 15:52:24 +0200 Subject: [PATCH] convert except a,b to except a as b --- DDCore/python/dd4hepFactories.py | 6 +++--- DDG4/examples/readHEPMC.py | 2 +- DDG4/python/checkGeometry.py | 4 ++-- DDG4/python/checkOverlaps.py | 4 ++-- DDG4/python/g4MaterialScan.py | 4 ++-- DDRec/python/dumpDetectorData.py | 6 +++--- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/DDCore/python/dd4hepFactories.py b/DDCore/python/dd4hepFactories.py index ce7265599..71eba0ba1 100755 --- a/DDCore/python/dd4hepFactories.py +++ b/DDCore/python/dd4hepFactories.py @@ -104,7 +104,7 @@ class ComponentDumper: "<D> to DUMP the list of components \n"+ "<S> to SKIP this particular library\n"+ "<L> to no longer LOAD libraries \n") - except Exception,X: + except Exception as X: ret = 'D' if not len(ret): ret = 'D' @@ -156,13 +156,13 @@ try: from ROOT import gROOT from ROOT import gSystem gROOT.SetBatch(1) -except ImportError,X: +except ImportError as X: logger.error('PyROOT interface not accessible: %s',str(X)) sys.exit(errno.ENOENT) try: import dd4hep -except ImportError,X: +except ImportError as X: logger.error('dd4hep python interface not accessible: %s',str(X)) sys.exit(errno.ENOENT) diff --git a/DDG4/examples/readHEPMC.py b/DDG4/examples/readHEPMC.py index 43cbf49da..4e70ce240 100644 --- a/DDG4/examples/readHEPMC.py +++ b/DDG4/examples/readHEPMC.py @@ -31,7 +31,7 @@ def run(input_file): try: ret = gen.readParticles(evtid,prim_vtx,parts) evtid = evtid + 1 - except Exception,X: + except Exception as X: logger.error( '\nException: readParticles: %s',str(X)) ret = None if ret: diff --git a/DDG4/python/checkGeometry.py b/DDG4/python/checkGeometry.py index 813ce657a..b5e6dcec1 100755 --- a/DDG4/python/checkGeometry.py +++ b/DDG4/python/checkGeometry.py @@ -63,13 +63,13 @@ try: import ROOT from ROOT import gROOT gROOT.SetBatch(1) -except ImportError,X: +except ImportError as X: logger.error('PyROOT interface not accessible: %s',str(X)) sys.exit(errno.ENOENT) try: import dd4hep -except ImportError,X: +except ImportError as X: logger.error('dd4hep python interface not accessible: %s',str(X)) sys.exit(errno.ENOENT) diff --git a/DDG4/python/checkOverlaps.py b/DDG4/python/checkOverlaps.py index 2ea26a344..b687439b8 100755 --- a/DDG4/python/checkOverlaps.py +++ b/DDG4/python/checkOverlaps.py @@ -47,14 +47,14 @@ try: import ROOT from ROOT import gROOT gROOT.SetBatch(1) -except ImportError,X: +except ImportError as X: logger.error('PyROOT interface not accessible: %s',str(X)) logger.error("%s",parser.format_help()) sys.exit(errno.ENOENT) try: import dd4hep -except ImportError,X: +except ImportError as X: logger.error('dd4hep python interface not accessible: %s',str(X)) logger.error("%s",parser.format_help()) sys.exit(errno.ENOENT) diff --git a/DDG4/python/g4MaterialScan.py b/DDG4/python/g4MaterialScan.py index c5029e320..c5698a0d7 100644 --- a/DDG4/python/g4MaterialScan.py +++ b/DDG4/python/g4MaterialScan.py @@ -107,14 +107,14 @@ try: import ROOT from ROOT import gROOT gROOT.SetBatch(1) -except ImportError,X: +except ImportError as X: logger.error('PyROOT interface not accessible: %s', X) logger.info(parser.format_help()) sys.exit(errno.ENOENT) try: import DDG4, SystemOfUnits -except ImportError,X: +except ImportError as X: logger.error('DDG4 python interface not accessible: %s', X) logger.info(parser.format_help()) sys.exit(errno.ENOENT) diff --git a/DDRec/python/dumpDetectorData.py b/DDRec/python/dumpDetectorData.py index f317a4f74..e8af8ded2 100644 --- a/DDRec/python/dumpDetectorData.py +++ b/DDRec/python/dumpDetectorData.py @@ -67,21 +67,21 @@ try: import ROOT from ROOT import gROOT gROOT.SetBatch(1) -except ImportError,X: +except ImportError as X: logger.error('PyROOT interface not accessible: %s',str(X)) logger.error("%s",parser.format_help()) sys.exit(errno.ENOENT) try: import dd4hep -except ImportError,X: +except ImportError as X: logger.error('dd4hep python interface not accessible: %s',str(X)) logger.error("%s",parser.format_help()) sys.exit(errno.ENOENT) # try: import DDRec -except ImportError,X: +except ImportError as X: logger.error('ddrec python interface not accessible: %s',str(X)) logger.error("%s",parser.format_help()) sys.exit(errno.ENOENT) -- GitLab