Skip to content

Commit

Permalink
BF: iohub eyelink sendMessage saving byte array
Browse files Browse the repository at this point in the history
In Python3 sendMessage() method of the iohub eyelink eyetracker class was sending byte arrays to pylink sendMessage() instead of String, resulting in b'....' being added to message contents in EDF file.  Now byte arrays are converted to a string using 'utf-8'.
  • Loading branch information
isolver committed Feb 10, 2020
1 parent c122582 commit 1a8c692
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -371,18 +371,22 @@ def sendMessage(self, message_contents, time_offset=None):
"""
try:
if isinstance(message_contents, bytes):
message_contents = message_contents.decode('utf-8')

if time_offset:
r = self._eyelink.sendMessage(
'\t%d\t%s' %
(time_offset, message_contents))
else:
r = self._eyelink.sendMessage(message_contents)
r = self._eyelink.sendMessage('%s'%message_contents)

if r == 0:
return EyeTrackerConstants.EYETRACKER_OK
return EyeTrackerConstants.EYETRACKER_ERROR
except Exception as e:
printExceptionDetailsToStdErr()
return EyeTrackerConstants.EYETRACKER_ERROR

def runSetupProcedure(self):
"""Start the EyeLink Camera Setup and Calibration procedure.
Expand Down

0 comments on commit 1a8c692

Please sign in to comment.