Skip to content
Snippets Groups Projects
Commit 1d09fc9c authored by Mark Smith's avatar Mark Smith Committed by Marco Cattaneo
Browse files

fix exec locals

parent 8fed37be
No related branches found
No related tags found
4 merge requests!1039Fixed formatting,!1000Fixed formatting,!864Fix crash in TupleToolHerschel when multiple versions are present,!693Python3 fixes
......@@ -101,7 +101,7 @@ def addTupleTool(self, tool, name=None):
tooltype = ''
toolname = ''
toolinstance = ''
_locals = locals()
################# Step 2: retrieve the configurable for the tool in question ############
if type(tool) is str:
tool, name2 = self.__splitname__(tool)
......@@ -109,14 +109,14 @@ def addTupleTool(self, tool, name=None):
name = name2
#will fail here if the configurable doesn't exist
try:
exec ('from Configurables import ' + tool)
exec ('config = ' + tool + '()')
exec ('from Configurables import ' + tool, globals(), _locals)
exec ('config = ' + tool + '()', globals(), _locals)
config = _locals['config']
except ImportError:
raise ImportError('The TupleTool ' + tool +
' does not exist, check the name and try again')
else:
config = tool
################# Step 3: add to Self ###################################################
if name is None: self.addTool(config)
else: self.addTool(config, name)
......@@ -137,10 +137,10 @@ def addTupleTool(self, tool, name=None):
tool = tool.split(".")[-1]
if name is None:
exec ('instance=self.' + tool)
exec ('instance=self.' + tool, globals(), _locals)
else:
exec ('instance=self.' + name)
exec ('instance=self.' + name, globals(), _locals)
instance = _locals['instance']
#mother,tool,name=instance.splitName()
if instance.getFullName() in self.ToolList:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment