0

I want to launch a program from python, in this case abaqus (a finite element analysis software), using:

os.system('abaqus job=' + JobName + ' user=' + UELname + ' interactive')

After say 5 minutes running the program I want to execute a python script that monitors some output files generated by abaqus. If a certain condition is met than the python script will terminate the abaqus job. There's a catch here. To read the output files I need to run the python script from abaqus:

os.system('abaqus cae noGUI=results2.py')

My question is this:

Can I do this simply by:

os.system('abaqus job=' + JobName + ' user=' + UELname + ' interactive')
time.sleep(300)
os.system('abaqus cae noGUI=results2.py')

I know that using interactive key makes ths system wait for the abaqus job to finish before doing other stuff. Therefore, I asssume this is not as simple as I'd like it to be. Any ideas?

2 Answers 2

2

Did you try subprocess module?

Sign up to request clarification or add additional context in comments.

Comments

1

Logic seems fine, i would suggest you to use subprocess, instead of os.system. Since you are calling commands, you can run all these commands at once like this

cmdToRun = '\'abaqus job=\' + JobName + \' user=\' + UELname + \' interactive\' ; sleep 300; abaqus cae noGUI=results2.py'

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.