Loading environment modules within a python script

后端 未结 4 1383
一个人的身影
一个人的身影 2020-12-05 07:13

Is there a way for a python script to load and use environment modules? os.system(\'module load xxx\') doesn\'t work since it executes them in a subshell (at le

4条回答
  •  失恋的感觉
    2020-12-05 07:50

    One of our admins was able to solve the problem for me using os.popen() calls to modulecmd:

    cmd = os.popen('/path/to/modulecmd python load my-module')
    exec(cmd)
    

提交回复
热议问题