Message 1 of 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Working on a script and having a problem.
app = adsk.core.Application.get() ui = app.userInterface size=ui.inputBox('Screw size','SHCS','')
This creates an input dialog box.
I enter: 1/4
Later in the code I read a csv file:
dlg = ui.createFileDialog() dlg.title = 'Open CSV File' dlg.filter = 'Comma Separated Values (*.csv);;All Files (*.*)' if dlg.showOpen() != adsk.core.DialogResults.DialogOK : return filename = dlg.filename f = open(filename, 'r') line = f.readline() data = [] while line: pntStrArr = line.split(',') for pntStr in pntStrArr: data.append( str(pntStr)) if len(data)>=5 : screw = data[0] string = (data[0], data[1], data[2], data[3], data[4]) # if screw = size : print(size) print(screw) #input(string) line = f.readline() data.clear() f.close()
The csv file contains lines:
1/4,.375,.5,.75,1/4
1/2,.625,.75,1.0,1/2
and so on.
The red lines:
print(size) Prints:1/4
print(screw) Prints: ['1/4', False]
If it is reading 1/4 from the file, why is it printing ['1/4', False] ?
Brad Bylls
Solved! Go to Solution.