Salome HOME
[PY3] exec statement called with globals() dict
authorGilles DAVID <gilles-g.david@edf.fr>
Wed, 29 Mar 2017 13:43:38 +0000 (15:43 +0200)
committerGilles DAVID <gilles-g.david@edf.fr>
Wed, 29 Mar 2017 13:51:14 +0000 (15:51 +0200)
src/KERNEL_PY/batchmode_salome.py
src/KERNEL_PY/salome_iapp.py

index d7645f7386d5f4f8e160f58fe3ee4f0ae288e620..06e1ffbae8d3959175c5befef847888cea4e262e 100755 (executable)
@@ -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
 
     #--------------------------------------------------------------------------
index 771a68a048fe55d8636f054e5e768f488543f843..b7aa1557d240cacb290d435577274b168e2b1e97 100755 (executable)
@@ -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"""