psychopy.org | Reference | Downloads | Github

TypeError when initializing iohub for eyetracking

Hi all,

I’m trying to run this eyetracking demo script from the Psychopy github repo, but it gives a perplexing error.

Here’s the error I get:

##### Running: C:\PATH_TO_FILE\simple.py #####
Traceback (most recent call last):
  File "C:\PATH_TO_FILE\simple.py", line 40, in <module>
    r = tracker.runSetupProcedure()
  File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\iohub\client\__init__.py", line 63, in __call__
    r = r[1:]
TypeError: 'NoneType' object has no attribute '__getitem__'

It looks like this error arises in psychopy.iohub.client.__init__.py during the DeviceRPC class definition, but I’m not sure where that class is being instantiated.

Another strange thing about this error: The error appears on the Psychopy output window before the Eyelink config screen appears. However, nothing in the script executes after r = tracker.runSetupProcedure().

Any suggestions would be greatly appreciated!

Thanks,
Geoff

System details: Eyelink 1000, Psychopy 1.90.2, Windows 10

Hi again,

Some other information that might be useful for diagnosing the problem: The calibration and validation seems to work correctly (until the script exits immediately afterward), but when you try to show the EyeLink monitor on the stimulus controller computer, Python hangs until you force-quit.

Thanks,
geoff

For anyone else who encounters this problem, here’s how I got around it. The iohub library seems to be broken, but you can use pylink directly. I’m including an example script to print the location of the gaze. Hopefully this is useful!

import pylink as pl
from psychopy import core, event, visual

screen_resolution = (1920, 1080)

# Open the calibration screen
pl.flushGetkeyQueue()
pl.openGraphics()

# Calibrate the eyetracker
el = pl.EyeLink()
el.doTrackerSetup(width=screen_resolution[0],
                  height=screen_resolution[1])
el.enableAutoCalibration()
el.setCalibrationType('HV9')
el.setAutoCalibrationPacing(1000)
## This brings up a blank grey screen.
## Press ENTER to see the camera view
## Press C to calibrate the eye-tracker
## Press V to validate
## Press ESC to close the window

# Close the calibration screen
pl.closeGraphics()

# Start getting data from the eye-tracker
el.open()
el.flushKeybuttons(0)
el.startData(15, 1) # All event types
el.startRecording(1,1,1,1)
el.waitForData(5000, 1, 0)

# Print out the current location of the gaze
while True:
    # Print the gaze info
    sample = el.getNewestSample()
    sample = sample.getLeftEye().getGaze()
    sample = [int(e) for e in sample]
    print sample
    core.wait(0.2)
    r = event.getKeys(keyList=['escape'])
    if r:
        break

# Turn off the eye-tracker
el.stopData()
el.stopRecording()
el.close()

2 Likes