Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations The Obturator on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run abaqus script from Python interpreter 2

Status
Not open for further replies.

yaston4

Mechanical
Jan 9, 2012
130
Hi all,

At the moment I am running my Abaqus scripts through CAE using file -> run script -> scriptname.py

Is any code I can use in my python script to run it outside of CAE straight from the python interpreter?

Thanks.
 
Replies continue below

Recommended for you

sure, just use the noGUI option for abaqus, and run it i.e. from bash.
I usually use 'subprocess' module in python:

import subprocess

process = subprocess.call('abaqus cae noGUI=yourscript.py',shell=True)

 
Sorry I am still getting to grips with Python with Abaqus. Looking at the manual it seems that I can run "abaqus cae noGUI" from the CMD window.

What I currently do is write my python code in an IDE. When I write normal python code I can run it straight from the IDE at a click of button. I am wondering if there is anyway I can do this for Abaqus-python scripts.

Thanks for your help, and patience [thumbsup2]
 
IceBreakerSours, yes thats right, there is a few reasons I would like to do this.

1) I have had issues with opening text files and writing to text files (even though I use close file commmands. There I have had to use a sys.exit() command at the end of script to make sure all the files close. Python experts tell me that this is a problem with the way that Windows handles files opened from python. Anyways, what this means for me is that when I run a script from Abaqus CAE or the command line in Abaqus, then abaqus shuts down once the script has finished. Therefore everytime I want to re run the script I have to reopen abaqus, find the script in the file directory, etc etc.

2) Speed and convenience, I like using an IDE and running python code directly from it, I find it helps save time when I am developing and debugging.

I hope that makes sense, I look forward to further discussion.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor