| Reference | Downloads | Github

Python crashing with eyetracking experiment


I have been trying to make a fairly straight forward eyetracking experiment using the Psychopy builder and an eyelink eyetracking system. Although the demos run and very basic experiments that I have built from those demos run, when I try to add in more functionality (i.e. random assignment of coordinates for pictures, etc) or add on more routines into the experiment flow the program stops running.

To be more specific the program will run the eyetracking calibration but once that is done and it tries going back into the main psychopy experiment I get an error message saying “python.exe has stopped working” and I have to close everything down. When I looked at the error details it comes up with an exception code of c0000005 and no errors are thrown from psychopy itself. Not sure what to make of this.

Any help or advice is appreciated.

  • Jon

You’ll need to be more specific to give anyone a chance of helping

How are you coding the eyetracking? In Code Components? Show us the code you’re inserting.

This works for some simple experiments but not others? Show us the exact changes that are needed to cause the problem. I probably can’t personally help because I don’t have an eyelink, but your current report means nobody can.


Sorry for the lack of information. I’m new to this type of forum.

To build on from my prior post the code for the eye-tracking is done in code snippets in individual routines throughout the experiment when eye-tracking is necessary as it is not needed on all of the trials / routines.

The initial code at the beginning of the experiment is a code snippet to check and make sure there is an eye-tracker and if so to start the calibration procedure is as follows:

eyetracker =False #will change if we get one!

if expInfo[‘Eye Tracker’]:
from psychopy.iohub import EventConstants,ioHubConnection,load,Loader
from psychopy.iohub.util import NumPyRingBuffer
from import getDateStr
# Load the specified iohub configuration file converting it to a python dict.
io_config=load(file(expInfo[‘Eye Tracker’],‘r’), Loader=Loader)

    # Add / Update the session code to be unique. Here we use the psychopy getDateStr() function for session code generation

    # Create an ioHubConnection instance, which starts the ioHubProcess, and informs it of the requested devices and their configurations.

    if io.getDevice('tracker'):


except Exception, e:
   import sys
   print "!! Error starting ioHub: ",e," Exiting..."


Then on individual trials and/or routines when eye tracking is necessary in a code snippet I placed this under the Begin Experiment tab:

if eyetracker:

And under the End Routine of the same snippet:

if eyetracker:

Just to reiterate the calibration procedure runs fine and it isn’t until I try to go back into the main experiment that I get the “python.exe has stopped working” message before I even get to the first screen of the experiment. Also, after some more testing it did work once though I haven’t changed anything since then (i.e. the code from above) and I’m getting the same “python.exe has stopped working” message.

Also it is worth mentioning that I took this code from the eye-tracking stroop demo that comes with psychopy, since it seemed to work fine and I figured it would be simple to build up from there. Just to note I am using the latest version of psychopy and am running this on a Windows computer.

  • Jon