| Reference | Downloads | Github

Pylink Eyelink 1000 AttributeError

Dear all,

I am trying to import an Eyelink 1000 device into Psychopy. I am using Psychopy 3.0.0 and a combination of pylink (2.7) and pygaze to import the device. The error message I can’t seem to figure out is that Python suggests that pylink does not have an attribute called ''EyeLinkCustomDisplay".

Below is the error message, followed by some excerpts from the code and some comments. Any help would be greatly appreciated. Perhaps noteworthy is that I ran the identical script in a WinPython standalone package which include pylink and pygaze (, and there the experiment works without any issues.

Error message in terminal:

"Traceback (most recent call last):
File “C:\Users\user1\Desktop\REST_study\eyetracking_tryout\”, line 24, in
tracker = EyeTracker(disp)
File “C:\Program Files (x86)\PsychoPy3\lib\site-packages\pygaze\”, line 64, in init
from pygaze._eyetracker.libeyelink import libeyelink
File “C:\Program Files (x86)\PsychoPy3\lib\site-packages\pygaze_eyetracker\”, line 29, in
from pygaze._eyetracker.eyelinkgraphics import EyelinkGraphics
File “C:\Program Files (x86)\PsychoPy3\lib\site-packages\pygaze_eyetracker\”, line 44, in
custom_display = pylink.EyeLinkCustomDisplay
AttributeError: module ‘pylink’ has no attribute ‘EyeLinkCustomDisplay’

In I am trying to create the tracker :

from pygaze.display import Display
from pygaze.screen import Screen
from pygaze.eyetracker import EyeTracker
import pygaze.libtime as timer

#Initialise the Display and a Screen.
disp = Display()
scr = Screen()

#Show a waiting message.
scr.draw_text(“Preparing experiment…”, fontsize=20)

#Open a connection to the eye tracker.

tracker = EyeTracker(disp) then needs additional information from libeyelink

	# EyeLink
	if trackertype == u'eyelink':
		# import libraries
		**from pygaze._eyetracker.libeyelink import libeyelink**
		# morph class
		self.__class__ = libeyelink
		# initialize
		self.__class__.__init__(self, display, **args)

and wants to import EyelinkGraphics:

from pygaze import settings
from pygaze.libtime import clock
import pygaze
from pygaze.screen import Screen
from pygaze.mouse import Mouse
from pygaze.keyboard import Keyboard
from pygaze.sound import Sound
from pygaze._eyetracker.eyelinkgraphics import EyelinkGraphics

In, there is in fact a class called EyelinkGraphics with an EyeLinkCustomDisplay module. Below, I copy-pasted line 44 and onwards:

custom_display = pylink.EyeLinkCustomDisplay

if settings.DISPTYPE == ‘pygame’:
import pygame
elif settings.DISPTYPE == ‘psychopy’:
import psychopy
import pygame

class EyelinkGraphics(custom_display):

Implements the EyeLink graphics that are shown on the experimental PC, such
as the camera image, and the calibration dots. This class only implements
the drawing operations, and little to no of the logic behind the set-up,
which is implemented in PyLink.

def __init__(self, libeyelink, tracker):


	libeyelink	--	A libeyelink object.
	tracker		--	An tracker object as returned by pylink.EyeLink().


	# objects
	self.libeyelink = libeyelink
	self.display = libeyelink.display
	self.screen = Screen(disptype=settings.DISPTYPE, mousevisible=False)
	self.kb = Keyboard(keylist=None, timeout=0)
	self.mouse = Mouse(timeout=0)
	if settings.DISPTYPE == 'pygame':
	# If we are using a DISPTYPE that cannot be used directly, we have to
	# save the camera image to a temporary file on each frame.
	#if DISPTYPE not in ('pygame', 'psychopy'):
	import tempfile
	import os
	self.tmp_file = os.path.join(tempfile.gettempdir(), '__eyelink__.jpg')
	# drawing properties
	self.xc = self.display.dispsize[0]/2
	self.yc = self.display.dispsize[1]/2
	self.extra_info = True
	self.ld = 40 # line distance
	self.fontsize = libeyelink.fontsize
	self.title = ""
	self.display_open = True
	# beeps
	self.__target_beep__ = Sound(osc='sine', freq=440, length=50,
		attack=0, decay=0, soundfile=None)
	self.__target_beep__done__ = Sound(osc='sine', freq=880, length=200,
		attack=0, decay=0, soundfile=None)
	self.__target_beep__error__ = Sound(osc='sine', freq=220, length=200,
		attack=0, decay=0, soundfile=None)
	# Colors
	self.color = {
		pylink.CR_HAIR_COLOR:			pygame.Color('white'),
		pylink.PUPIL_HAIR_COLOR:		pygame.Color('white'),
		pylink.PUPIL_BOX_COLOR:			pygame.Color('green'),
		pylink.SEARCH_LIMIT_BOX_COLOR:	pygame.Color('red'),
		pylink.MOUSE_CURSOR_COLOR:		pygame.Color('red'),
		'font':							pygame.Color('white'),
	# Font
	self.font = pygame.font.SysFont('Courier New', 11)
	# further properties
	self.state = None
	self.pal = None

	self.size = (0,0)
	self.last_mouse_state = -1
	self.bit64 = '64bit' in platform.architecture()
	self.imagebuffer = self.new_array()

any help would be immensely appreciated!

Well, I can confirm this is a version error (Script runs in Psychopy v2, not in v3).

1 Like

I had similar problems with a PsychoPy version that uses Python 3 but no problem with Python 2.

I recommend the thread linked in the answer of this question: Pylink receiveDataFile