psychopy.org | Reference | Downloads | Github

AttributeError: module 'psychopy.iohub.devices' has no attribute 'tracker'

Hello everybody! I need to connect an eye tracker to a psychoзн using the iohub library. Tell me how can I do this? I tried the following code from the Internet:

from psychopy.iohub import launchHubServer
from psychopy.core import getTime, wait
from psychopy import core, visual
import psychopy.iohub as io


'''config'''
tracker = io.devices.tracker
display = io.getDevice('display')
eyetracker.hw.sr_research.eyelink

tracker_config = {'eyetracker.hw.gazepoint.gp3.EyeTracker':
    {'name': 'tracker', 'device_timer': {'interval': 0.005}}}     

'''Config'''
iohub_config = {'eyetracker.hw.gazepoint.gp3.EyeTracker':
    {'name': 'tracker', 'device_timer': {'interval': 0.005}}}

'''Calibration'''
r = tracker.runSetupProcedure()

But in the end I get the following error:
AttributeError: module ‘psychopy.iohub.devices’ has no attribute ‘tracker’

OS: Windows 10

Please tell me what I’m doing wrong! I would be very grateful for any help!

Please take a look at the demos/coder/iohub/eyetracking/simple.py as an example, but you need to first start up iohub before accessing any of the devices by using launchHubServer. Something like the following for a GP3:

from psychopy import core, visual
from psychopy.iohub.client import launchHubServer
import time

tracker_config = {'eyetracker.hw.gazepoint.gp3.EyeTracker': dict(name='tracker')}

io = launchHubServer(**tracker_config)

# Get some iohub devices for future access.
keyboard = io.getDevice('keyboard')
tracker = io.getDevice('tracker')

# run eyetracker calibration
tracker.runSetupProcedure()

#....

Also be sure that the GazePoint Control app is also running when you start the experiment.