I’m confused as to why the input seems to be a collection but shows up in python as a single value. Python script and GH definition shown below.
import rhinoscriptsyntax as rs
import csv
typeMxx = 0; typeMyy = 1; typeTorsion = 2; typeMtot = 3
mxxFile = 'C:\Documents\LaGuajiraConstruccion\data\mxx.csv'
myyFile = 'C:\Documents\LaGuajiraConstruccion\data\mxx.csv'
torsionFile = 'C:\Documents\LaGuajiraConstruccion\data\torsion.csv'
mtotFile = 'C:\Documents\LaGuajiraConstruccion\data\mtot.csv'
def writeData(type,strength,location):
fName = None
if type == typeMxx:
fName = mxxFile
elif type == typeMyy:
fName = myyFile
elif type == typeTorsion:
fName = torsionFile
elif type == typeMtot:
fName = mtotFile
with open(fName,'w') as f:
writer = csv.writer(f, delimiter=',')
for i in len(strength):
writer.writerow([location[i],strength[i]])
if __name__ == "__main__":
print(strength)
print(location)
writeData(type,strength,location)
Generated error:
Runtime error (TypeErrorException): iteration over non-sequence of type int
Traceback:
line 33, in writeData, "<string>"
line 39, in script