Skip to content

Commit d49f154

Browse files
authored
BF: Corrected Str to Byte in colorcal.py
Corrects str to byte conversions in colorcal for PY3
1 parent 3bf1b7e commit d49f154

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

psychopy/hardware/crs/colorcal.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,6 @@ def sendMessage(self, message, timeout=0.1):
149149
continue
150150
else:
151151
# line without any eol chars
152-
#myLine=thisLine.encode('ascii')
153-
#myLine=thisLine.rstrip(eol.encode('ascii'))
154-
#lines.append(thisLine)
155152
lines.append(thisLine.rstrip(eol.encode('ascii')))
156153
nEmpty = 0
157154

@@ -180,7 +177,7 @@ def measure(self):
180177
"""
181178
# use a long timeout for measurement:
182179
val = self.sendMessage(b'MES', timeout=5)
183-
valstrip=val.strip(b'\n\r>')
180+
valstrip = val.strip(b'\n\r>')
184181
vals = valstrip.split(b',')
185182
ok = (vals[0] == 'OK00')
186183
# transform raw x,y,z by calibration matrix
@@ -210,15 +207,14 @@ def getInfo(self):
210207
211208
"""
212209
val = self.sendMessage(b'IDR')
213-
valstrip=val.strip(b'\n\r>')
214-
val=valstrip.split(b',')
210+
valstrip = val.strip(b'\n\r>')
211+
val = valstrip.split(b',')
215212
ok = (val[0] == b'OK00')
216213
if ok:
217214
firmware = val[2]
218215
serialNum = val[4]
219216
firmBuild = val[-1]
220217
else:
221-
print('not ok')
222218
firmware = 0
223219
serialNum = 0
224220
firmBuild = 0
@@ -290,7 +286,7 @@ def getCalibMatrix(self):
290286
for rowN in range(3):
291287
rowName = 'r0%i' % (rowN + 1)
292288
val = self.sendMessage(rowName.encode('ascii'), timeout=1.0)
293-
valstrip=val.strip(b'\n\r>')
289+
valstrip = val.strip(b'\n\r>')
294290
vals = valstrip.split(b',') # convert to list of values
295291
if vals[0] == b'OK00' and len(vals) > 1:
296292
# convert to numpy array

0 commit comments

Comments
 (0)