From dd01ecf5fcb4b7383cedb2c46747db789b7be07a Mon Sep 17 00:00:00 2001 From: Gilles DAVID Date: Wed, 16 Jan 2019 13:55:42 +0100 Subject: [PATCH] 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. --- bin/salomeContext.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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 **") -- 2.39.2