From: Gilles DAVID Date: Wed, 16 Jan 2019 12:55:42 +0000 (+0100) Subject: Fix command to set the module environment X-Git-Tag: V9_3_0a1~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=dd01ecf5fcb4b7383cedb2c46747db789b7be07a;p=modules%2Fkernel.git Fix command to set the module environment Previous command modulecmd is not used anymore on Debian 9. A fix is to search for the LMOD_CMD environement variable. This suppose that lmod is installed. --- diff --git a/bin/salomeContext.py b/bin/salomeContext.py index 0d65b3797..3ab39b637 100644 --- a/bin/salomeContext.py +++ b/bin/salomeContext.py @@ -101,10 +101,14 @@ class SalomeContext: # def __loadEnvModules(self, env_modules): - print("Trying to load env modules: %s..." % ' '.join(env_modules)) + print("Trying to load env modules: %s ..." % ' '.join(env_modules)) + modulecmd = os.getenv('LMOD_CMD') + if not modulecmd: + print('Module environment not present') + return try: - out, err = subprocess.Popen(["modulecmd", "python", "load"] + env_modules, stdout=subprocess.PIPE).communicate() - exec(out) # define specific environment variables + out, err = subprocess.Popen([modulecmd, "python", "load"] + env_modules, stdout=subprocess.PIPE).communicate() + exec(out) # define specific environment variables print("OK") except: print("** Failed **")