0

When I use the linux shell I write module load numeca/open/61_numeca_mpi, I press enter, the program uploads the module licence, and then I write fine and press enter again. I wrote a Python script which does this.

import os

os.system("module load numeca/open/61_numeca_mpi")
os.system("fine")

It uploads the module licence but then it says

ERROR:105: Unable to locate a modulefile for 'fine'.

Any suggestions?

1
  • The problem with what you tried is that os.system opens a new shell for each command, this means that the fine you sent was in a different shell then the the module command before it Commented Jun 19, 2017 at 12:46

2 Answers 2

1

Try using the subprocess module:

import subprocess
p= subprocess.Popen(['module','load numeca/open/61_numeca_mpi"'],stdout=subprocess.PIPE,stdin=subprocess.PIPE)
p.stdin.write('fine')
p.communicate()[0]
p.stdin.close()
Sign up to request clarification or add additional context in comments.

Comments

0

Try executing both commands in the same shell, like this:

os.system("module load numeca/open/61_numeca_mpi && fine")

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.