diff --git a/Control/AthenaCommon/python/Configurable.py b/Control/AthenaCommon/python/Configurable.py index 67af258f09c16f14876cc9aa481c3321e20ad545..f0bd982aafe3bbd46f2ed500e75d9dd136422d7c 100755 --- a/Control/AthenaCommon/python/Configurable.py +++ b/Control/AthenaCommon/python/Configurable.py @@ -5,7 +5,7 @@ # Author: Martin Woudstra (Martin.Woudstra@cern.ch) import copy, types, os, weakref,sys -import ConfigurableMeta +from AthenaCommon import ConfigurableMeta # Note: load iProperty etc. from GaudiPython only as-needed import GaudiKernel.GaudiHandles as GaudiHandles @@ -118,7 +118,7 @@ class Configurable( object ): for n,v in kwargs.items(): try: setattr( conf, n, v ) - except AttributeError, originalAttributeError: + except AttributeError as originalAttributeError: # rather annoying that we have to be somewhat silent here (the # most common cases are 'name' and user kw args to be supplied # to an overridden __init__) @@ -191,7 +191,7 @@ class Configurable( object ): # this is an abstract class if klass == Configurable: - raise TypeError, "%s is an ABC and can not be instantiated" % str(Configurable) + raise TypeError( "%s is an ABC and can not be instantiated" % str(Configurable)) # for using this Configurable as a (Gaudi) sequence self.__children = [] @@ -441,8 +441,7 @@ class Configurable( object ): # make sure base class init has been called if not hasattr(self,'_fInitOk') or not self._fInitOk: # could check more, but this is the only explanation - raise TypeError, \ - "Configurable.__init__ not called in %s override" % self.__class__.__name__ + raise TypeError("Configurable.__init__ not called in %s override" % self.__class__.__name__) # setup self: this collects all values on the python side self.__setupServices() diff --git a/Control/AthenaCommon/python/ConfigurableMeta.py b/Control/AthenaCommon/python/ConfigurableMeta.py index cc1039c2c98eb8f8ec6a54a6eaccad87c19f3e6f..e16f4172074e74bedb1c6fb56b8bf91dfbb6ae17 100755 --- a/Control/AthenaCommon/python/ConfigurableMeta.py +++ b/Control/AthenaCommon/python/ConfigurableMeta.py @@ -4,7 +4,7 @@ # Author: Wim Lavrijsen (WLavrijsen@lbl.gov) import weakref -import Logging, PropertyProxy +from AthenaCommon import Logging, PropertyProxy ### data --------------------------------------------------------------------- @@ -49,13 +49,13 @@ class ConfigurableMeta( type ): try: f = getattr( newclass, meth ).im_func except AttributeError: - raise NotImplementedError, "%s is missing in class %s" % (meth,str(newclass)) + raise NotImplementedError("%s is missing in class %s" % (meth,str(newclass))) # in addition, verify the number of arguments w/o defaults nargcount = f.func_code.co_argcount ndefaults = f.func_defaults and len(f.func_defaults) or 0 if not nargcount - ndefaults <= nArgs <= nargcount: - raise TypeError, "%s.%s requires exactly %d arguments" % (newclass,meth,nArgs) + raise TypeError("%s.%s requires exactly %d arguments" % (newclass,meth,nArgs)) # cache references of instances by name for duplicate removal newclass.configurables = weakref.WeakValueDictionary() diff --git a/Control/AthenaCommon/python/Logging.py b/Control/AthenaCommon/python/Logging.py index 4476ce951e94910f8a3c59e0c9287bc9511ddd87..2db86d2fb55f4b674f21fd7f01611385aaf0d9a8 100755 --- a/Control/AthenaCommon/python/Logging.py +++ b/Control/AthenaCommon/python/Logging.py @@ -5,7 +5,7 @@ """Athena Python-side logging.""" -import Constants +from AthenaCommon import Constants ### data _____________________________________________________________________ diff --git a/Control/AthenaCommon/python/PropertyProxy.py b/Control/AthenaCommon/python/PropertyProxy.py index ea0d644aa55c55f9fb4e54bbefd22bc23d3f5ca6..6323ac1e4c7dd387789481af0aade7d757609019 100755 --- a/Control/AthenaCommon/python/PropertyProxy.py +++ b/Control/AthenaCommon/python/PropertyProxy.py @@ -233,7 +233,7 @@ class GaudiHandlePropertyProxyBase(PropertyProxy): self.__set__( obj, default ) else: return default - except AttributeError,e: + except AttributeError as e: import traceback traceback.print_exc() # change type of exception to avoid false error message @@ -308,7 +308,7 @@ class GaudiHandlePropertyProxyBase(PropertyProxy): try: conf = self.getDefaultConfigurable(typeAndName, self.fullPropertyName(obj)) # print self.fullPropertyName(obj) + ": Setting default private configurable (from default handle): %r" % conf - except AttributeError,e: + except AttributeError as e: # change type of exception to avoid false error message raise RuntimeError(*e.args) if conf is None: