Hi,
I have a piece of code that performs the same test. It is a method inside a class:
I have another method for AngB that performs the same comparative test. However, method AngleA only works if I pass a string into it:
and AngB only works if I pass float data into it:
However, the 'if newAngA< 0 or newAngA> 360:' statement is the same (except for the newAngA newAngB local variable). Can anyone suggest why this might be the case? Could it be to do with passing by value? The data is created from a csv file which I read and convert to a list.
Thanks in advance!
I have a piece of code that performs the same test. It is a method inside a class:
Python:
def setAngleA(self, newAngA): # set the gantry angle for that control point.
if newAngA< 0 or newAngA> 360:
print newAngA+ ' is not a valid angle.'
else:
self.__AngA = newAngA
I have another method for AngB that performs the same comparative test. However, method AngleA only works if I pass a string into it:
Python:
test.setAngleA(str(Data[i][0]))
Python:
test.setAngleB(float(Data[i][1]))
However, the 'if newAngA< 0 or newAngA> 360:' statement is the same (except for the newAngA newAngB local variable). Can anyone suggest why this might be the case? Could it be to do with passing by value? The data is created from a csv file which I read and convert to a list.
Python:
def readPlanDataFromCSV(filename): # , rowNum, columnNum): #columnStart = '', columnEnd = ''):
import csv
tempFile = open(filename, "rb")
reader = csv.reader(tempFile)
planList = []
for row in reader:
planList.append(row)
return planList
tempFile.close()
Thanks in advance!