From: Gilles DAVID Date: Wed, 29 Mar 2017 13:43:38 +0000 (+0200) Subject: [PY3] exec statement called with globals() dict X-Git-Tag: V9_0_0~25^2~11^2~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=17ffd25f27362d4e5349f9a6f1c9650d11c95eba;p=modules%2Fkernel.git [PY3] exec statement called with globals() dict --- diff --git a/src/KERNEL_PY/batchmode_salome.py b/src/KERNEL_PY/batchmode_salome.py index d7645f738..06e1ffbae 100755 --- a/src/KERNEL_PY/batchmode_salome.py +++ b/src/KERNEL_PY/batchmode_salome.py @@ -35,10 +35,10 @@ from SALOME_NamingServicePy import * def ImportComponentGUI(ComponentName): libName = "lib" + ComponentName + "_Swig" command = "from " + libName + " import *" - exec ( command ) + exec (command, globals()) constructor = ComponentName + "GUI_Swig()" command = "gui = " + constructor - exec ( command ) + exec (command, globals()) return gui #-------------------------------------------------------------------------- diff --git a/src/KERNEL_PY/salome_iapp.py b/src/KERNEL_PY/salome_iapp.py index 771a68a04..b7aa1557d 100755 --- a/src/KERNEL_PY/salome_iapp.py +++ b/src/KERNEL_PY/salome_iapp.py @@ -38,11 +38,11 @@ def ImportComponentGUI(ComponentName): if IN_SALOME_GUI: libName = "lib" + ComponentName + "_Swig" command = "from " + libName + " import *" - exec ( command ) + exec (command, globals()) constructor = ComponentName + "_Swig()" command = "gui = " + constructor - exec ( command ) - return gui + exec (command, globals()) + return gui # @UndefinedVariable else: print("Warning: ImportComponentGUI(",ComponentName,") outside GUI !") print("calls to GUI methods may crash...") @@ -100,7 +100,7 @@ class SalomeOutsideGUI(object): def getSelected(self, i): """Get the selection number i """ print("SalomeOutsideGUI: no selection mecanism available outside GUI") - return none + return None def AddIObject(self, Entry): """Add an entry"""