From b2175d70917d70926623f3a9999031f578183f92 Mon Sep 17 00:00:00 2001 From: Patrick Rainsberry Date: Wed, 18 Oct 2017 07:10:00 -0700 Subject: [PATCH] Added Check for comment in csv file --- ParameterIO.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/ParameterIO.py b/ParameterIO.py index 2115840..c9704fa 100755 --- a/ParameterIO.py +++ b/ParameterIO.py @@ -221,13 +221,17 @@ def readTheParameters(theFileName): nameOfParam = row[0] unitOfParam = row[1] expressionOfParam = row[2] - # userParameters.add does not like empty string as comment - # so we make it a space - commentOfParam = row[3] - # comment might be missing - if commentOfParam == '': - commentOfParam = ' ' - + + # First check to see if comment exists in csv file + if len(row) > 3: + commentOfParam = row[3] + # userParameters.add does not like empty string as comment + # so we make it a space + # comment might be missing + if commentOfParam == '': + commentOfParam = ' ' + else: + commentOfParam = ' ' # if the name of the paremeter is not an existing parameter add it if nameOfParam not in paramsList: valInput_Param = adsk.core.ValueInput.createByString(expressionOfParam)