Home › Forums › Software Development › Tobii Pro Fusion with python, cannot print gaze data › Reply To: Tobii Pro Fusion with python, cannot print gaze data
09/05/2023 at 05:17 #23196
daisuke
Participant
Yes, I have installed the runtime service and confirmed that it is running on task manager.
I have also done the initial device setup.
When I enable the gaze visualization in ETM, gaze position is displayed without any problems.
I get no error massages and gaze data.
But the following code returns an error “‘left_pd’ is not defined”
import tobii_research as tr
found_eyetrackers = []
while len(found_eyetrackers) == 0:
found_eyetrackers = tr.find_all_eyetrackers()
my_eyetracker = found_eyetrackers[0]
def gaze_data_callback(gaze_data):
left_pd = gaze_data['left_pupil_diameter']
right_pd = gaze_data['right_pupil_diameter']
my_eyetracker.subscribe_to(
tr.EYETRACKER_GAZE_DATA, gaze_data_callback, as_dictionary=False)
pd = (left_pd + right_pd)/2
I wondered if you could help me.