psychopy.org | Reference | Downloads | Github

Experiment crashes with IndexError

If this template helps then use it. If not then just delete and start from scratch.

OS (e.g. Win10): Experiment runs on Win7, but was created on Win10
PsychoPy version (e.g. 1.84.x): 2021.2.3 (this is the version used on all computers, regardless of Windows version)
Standard Standalone? (y/n) If not then what?: Y

I have an experiment (file attached) that I’ve successfully run previously on Pavlovia, using a different version of PsychoPy. Now I’m running that experiment locally on PsychoPy with the newest version. To avoid any PsychoPy version conflicts, I recreated the experiment in PsychoPy 2021.2.3.

When the experiment runs, it crashes about 60% of the time. When it crashes, I receive this error:

    if TPresence==0 and MouseResponse.clicked_name[0]==Finished:
IndexError: list index out of range
##### Experiment ended. #####

On the data file, it shows that a response was generated for the next trial, without showing any stimuli for that trial (file attached). I suspect that the experiment is loading the stimuli too slowly and therefore it is being shown to the participant and they’re responding before the computer is able to update and process that the next trial is being shown.

Any suggestions for why this is happening or how to stop it??

Thank you,
Elisabeth

Experiment (GitLab link for downloadability): Elisabeth Slifkin / MultipleTargetSearch · GitLab
Data file: _MultipleTargetsVSP_2021_Sep_09_1350.csv (32.6 KB)

EDIT: I have just learned about the Static Component and tried to insert one during my fixation screen, but it did not seem to help. The experiment still crashed with the same error message. I did not include any additional code in the ISI itself. I’m including pictures of my experiment flow as well as the 2 relevant routines.


The fixation cross occurs immediately before the experimental trial screen (search display). The fixation cross is visible for .5 seconds.


I have 40 image stimuli that update every repeat. I now have all 40 images set to “set during: FixCross.ISI”


These are the relevant parts of the experiment flow. The FixCross and ExpTrial routines are the same routines during the PracticeBlockLoop and ExpBlockLoop.

I think you may have one or more columns in your excel sheet that you use in the loops that don’t have headers

Hi @tokaalmighty, all of my columns in my Excel sheet have headers. All columns in my data file have headers as well, and all expected columns are there.

Can you advance without clicking anything. I think that the iissue is that clickedName doesn’t exist and therefore doesn’t have an index 0

You have to click the Done button to end the trial. Whether you click anything before that is up to you.

The reason I don’t think the issue is something quite this simple is because it crashes at totally random points. There are 176 trials, and I’ve seen it crash anywhere between trial 13 and trial 171.

Take off any trial randomisation to see if it’s a particular trial causing the issue.

There is no randomization; trials run sequentially from the excel sheet. It will crash on different trials. I am sure of this because the error that appears is based on the trial. They’re all index errors but the specifics differ. Basically, the index error is coming from a piece of code I have to compute accuracy. As soon as the trial appears, if you click on any stimuli (doesn’t matter which stim or how quickly/slowly you click) it crashes with an index error. Removing this piece of code doesn’t solve the issue either.

The other problem is, I can only test this on computers at school. They’re all older and running Windows 7. The experiment doesn’t crash on the computer I built it on, or any other computer I own. It only crashes on the ones at school I need it to run on :frowning: