Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Python script help

Status
Not open for further replies.

satyasrinivas

Structural
Jan 18, 2008
67
Hi,

I need to convert an Abaqus input file into a different file format - to do this I obtained a python script. But I have no idea how to run a python script on a file.I have never used python scripting before.

Could someone please suggest me how could I run a python script on a file (say "abc.inp"). I have installed python 3.0

Thanks in advance,
SS
 
Replies continue below

Recommended for you

If you have ABAQUS CAE. You could import the input file int CAE. Then go to file> run script.

Gurmeet
 
Hi Gurmeet and MMS,

I tried both the approaches. But I could not convert my inp file to crk file. I am attaching the Python code and the inp file to this mail (both are in a compressed folder). Could you please take a look at it and let me know what is it I am doing wrong. Flawsurfs.py is the code I need to run.

All I need it to be able to run the Flawsurfs.py code on Crack.inp and generate a .crk file. I greatly appreciate any help you could offer.

Thanks,
Rajesh
 
 http://files.engineering.com/getfile.aspx?folder=5c52f523-c8e5-454c-933f-c3ccede21386&file=Frac.zip
I don't know what exactly you wanna do. but I checked out the scripts, afaik the Flawsurfs.py is not an abaqus runnable script, I think it is a simple python module that you can import it to another main script and use its functions and classes. you must find out or write another main script. it usually starts with "from abaqus import *"
but I think you can use the FESurfCrack.py like this:

*python FESurfCrack.py -tr 0.005 -inp Crack.inp > MMS.crk*
just run it in command prompt (without stars), you must have python installed.

Good Luck,

Mohammad Shahbazi
 
Thanks Mohammed.
I tried the command lines but I have been getting syntax error messages. I am surely missing something. I also tried IDLE to run the FESurfCrack module and it is showing some indentation errors. I tried to make them consistent, but they (indentation errors) keep coming.I am attaching the screen shots of the errors I am getting and the python code.

My experience with Python is 'Zero'. I just need to run this file to convert my inp files to crk files. I would greatly appreciate any help in rectifying this problem. I have Python 2.6 installed on my Windows PC.

Thanks again,
SS
 
 http://files.engineering.com/getfile.aspx?folder=222c26b7-06f5-4696-ad4f-b3fd5e0d91ff&file=Crack.zip
Thanks Mohammed.

I copied the batch file onto my PC and ran it (just double-clicked the batch file). But, it was just creating an empty (0 bytes) MMS.crk file.

Excuse my ignorance with computers. Am I supposed to edit the batch file ? Like changing the path or something . Please let me know.

The MMS.crk file you sent is exactly what I am looking forward to generate. I would greatly appreciate if you could suggest what are the steps I need to follow. Once again thanks so much for the help.

SS
 
The python path of your's must be set in the batch file.
set it and run it again. installing python adds its path to your windows paths.

Good luck,

Mohammad Shahbazi
 
Mohammad,

After copying the batch file you sent, to the folder which has the python script I want to run, I set the path to the Python executable in the batch file. Then I ran it. The fact is that it is running; but it is creating a MMS.crk file that is empty.

I am changing the path in the file you sent to something like C:\Python26\ which has the python executable. I will check it again. I may be missing something. Thanks so much for your help. I appreciate it.
 
Hi Mohammad,

I modified the path in the batch file as you suggested ( I am attaching the folder with the file). But for some reason, it is not generating the complete MMS.crk file.
I am not sure if it has to do anything with the Python version I have or the way my computer is set-up. Please let me know what you think may be wrong.

Thanks,
Rajesh
 
 http://files.engineering.com/getfile.aspx?folder=b0adee57-eace-4e8b-8ae6-473f4d5ab57e&file=Crack1.zip
I think the python scripts are modified and corrupted, so i have attached the working one and the batch file too.
just run it, it must work.
if not, i can help u interactively through yahoo or skype. my contact details are in my website.

Good luck,

Mohammad Shahbazi
www.OmranAfzar.com
 
 http://files.engineering.com/getfile.aspx?folder=19f8cde9-6919-480b-9dbc-981110edd63d&file=Crack1.zip
Status
Not open for further replies.

Part and Inventory Search

Sponsor