Salome HOME
Ban noisy messages
[modules/yacs.git] / bin / salomeContext.py
old mode 100644 (file)
new mode 100755 (executable)
index 3ab39b6..85d1326
@@ -1,4 +1,5 @@
-# Copyright (C) 2013-2017  CEA/DEN, EDF R&D, OPEN CASCADE
+#! /usr/bin/env python3
+# Copyright (C) 2013-2019  CEA/DEN, EDF R&D, OPEN CASCADE
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -101,17 +102,15 @@ class SalomeContext:
   #
 
   def __loadEnvModules(self, 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')
+      raise SalomeContextException("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
-      print("OK")
     except:
-      print("** Failed **")
+      raise SalomeContextException("Failed to load env modules: %s ..." % ' '.join(env_modules))
       pass
   #