From 17ffd25f27362d4e5349f9a6f1c9650d11c95eba Mon Sep 17 00:00:00 2001 From: Gilles DAVID Date: Wed, 29 Mar 2017 15:43:38 +0200 Subject: [PATCH] [PY3] exec statement called with globals() dict --- src/KERNEL_PY/batchmode_salome.py | 4 ++-- src/KERNEL_PY/salome_iapp.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) 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""" -- 2.39.2