Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

TypeError: data; found string, expecting tuple in Abaqus by Python Script

Status
Not open for further replies.

roy1989

Civil/Environmental
Dec 8, 2015
4
I want to read the data extracted from the text file into Abaqus File for the simulation. Here is my code:

import os
os.chdir(r"dir")
for file in os.listdir("dir"):
if file.endswith('.txt'):
print os.path.join(r"dir", file)
with open(file) as f:
lines = f.readlines()
for line in lines[:-1]:
first, second = tuple(map(float, line.split()))
print '(%g, %g),' % (first, second),
first, second = tuple(map(float, lines[-1].split()))
pp = '(%g, %g)' % (first, second)
print pp

mdb.models['Model-1'].TabularAmplitude(data=(pp), name='NewAmplitude', smooth=
SOLVER_DEFAULT, timeSpan=STEP)

The error which comes up is "TypeError: data; found string, expecting tuple". Can anyone help in solving the issue?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor