I am trying to read values through a loop from two different .csv files. I am being able to run the program perfectly when opening one .csv file; however, when I import the second .csv file, I get an error stated below:
Traceback (most recent call last): File "C:\Users\crteeic\Desktop\Project\Full Program (Testing).py", line 210, in with open('MagnaDC Set Points.csv', 'r') and ('Amatek Set Points.csv', 'r') as csvfile:
AttributeError: enter
The aim of the program is to read values from two .csv files and send these values to two different power supplies. Please find the code below:
with open('MagnaDC Set Points.csv', 'r') and ('Amatek Set Points.csv', 'r') as csvfile:
dataset = csv.reader(csvfile, delimiter=',')
next(dataset)
rows = list(dataset)
inputSamplesm = np.empty([len(rows), 2], dtype=float)
outputSamplesm = np.empty([1,3], dtype=float)
inputSamplesa = np.empty([len(rows), 2], dtype=float)
outputSamplesa = np.empty([1,3], dtype=float)
testStartTime = time.time()
for idx, data in enumerate(rows):
inputSamplesm[idx] = [data[0], data[1]]
inputSamplesa[idx] = [data[0], data[1]]
s.sendall('VOLT {0}\n'.format(data[0]).encode('utf-8'))
conn.write('VOLT {0}\n'.format(data[0]).encode('utf-8'))
stopTime = testStartTime + int(data[1])
Please advice. Thank you.