I am new to python and am learning things by writing scripts. I have tried the following and none of them seem to be working.
1) commands.getoutput('module load xxx')
2) subprocess.check_output(['module load', xxx'])
None of these change the environment as a side effect of the module call. Can someone tell me what is wrong?
In case it helps anyone, I managed to do it by prefixing all commands that depend on the module with module load xxx &&. For example,
module load mpi/mpich && mpirun ./myprogram -n 4 -options
Not an elegant solution, but works for me. There's also this answer but I couldn't make it work in the system I have access to.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With