×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Run abaqus script from Python interpreter
2

Run abaqus script from Python interpreter

Run abaqus script from Python interpreter

(OP)
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.

RE: Run abaqus script from Python interpreter

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)

RE: Run abaqus script from Python interpreter

(OP)
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

RE: Run abaqus script from Python interpreter

(OP)
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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources