| Reference | Downloads | Github

Eyetracking in py3.x


Hi all,

Is it possible to run an eyetracking experiment in python 3.x? I’ve seen pylink/ pylinkwrapper, and got it somewhat working in py2.7, but have generally switched over to py3.x. I know pylink itself is still a python 2.x package - does that prevent psychopy3 from being able to successfully interface with eyelink? ioHub doesn’t make reference to this specific limitation, though I’ve found it difficult figuring out how ioHub works from the documentation.

Thanks for your help!


The best thing to do is probably to try it and see. It’s likely that any Python 2 vs 3 incompatibilities can be solved.



Just to report that we have been successful in making a set of experiments using python 3 + psychopy + eyelink1000 and only that libraries. This was installed on a MacOs machine with a dual LED display (one for control, one in the setup room). This involved the use of different parts of code found in the pylink wrapper but also thanks to the excellent work of the pygaze team (in particular the script).

Most of the code for it is available @ and in particular in for the eye tracking part. Sorry that it is not 100% bullet-proof, that most comments are in french, but it is a workable solution. We are now in the process of separating that specific part into a proper package, any feedback is welcome.



How did you import pylink and which pylink version did you use for it to work in python 3?

When running

import pylink as pl

in either PsychoPy2PY3 or PsychoPy3 (Python 3) I receive the error message:
ModuleNotFoundError: No module named ‘pylink’

I also tried to paste the pylink folder into ‘C:\Program Files (x86)\PsychoPy3\Lib\site-packages’, but then I receive the error:
bad magic number in ‘pylink’: b’l\x0c\r\n’

I also tried to add the pylink folder to the paths (under Preferences), but then I get:
DLL load failed: %1 is not a valid Win32 application.

I am using a Windows PC and with Python 2.7 the pylink import worked just fine.

Any help would be appreciated!


Hi Corinna,

I have no experience with windows boxes. The import just works using a MacOs with the provided executables… See the screenshot with a minimal import. Do you have any to use a different OS, like a dual boot on your windows box?




Thanks for your reply!
Unfortunately using a different OS in that setup would not be easy right now.
I have contacted SR research now, as I have found out that they have not released any official pylink versions for Python 3.6 (at least not for Windows), but have some internal builds.
Hopefully my script runs with that, I will have to see.