psychopy.org | Reference | Downloads | Github

Moving from loop into new routine

I have a loop where a list of faces and additional variables are presented. Afterwords, the loop ends and goes into a new loop for a memory test. However, instead of going to the memory test it just crashes and gives me this error:

if trial_condition[trial_count][0]==1:
IndexError: list index out of range

How do i fix this?

What is the value of trial_count ?

if trial_condition[trial_count][0]==1:
VoluntaryMandatory=“mandatory”
thisExp.addData(“VoluntaryMandatory”,“Mandatory”)
else:
VoluntaryMandatory=“voluntary”
thisExp.addData(“VoluntaryMandatory”,“Voluntary”)

#ExperimentalvsControl
if trial_condition[trial_count][1]==1:
Itemface=image_set1[image_count][0]
Name=image_set1[image_count][1]
image_count=image_count+1
thisExp.addData(“Itemface”,image_set1[image_count][0])
thisExp.addData(“Name”,image_set1[image_count][1])
else:
Itemface=‘Blank screen’
Name= ‘Foodbank’
thisExp.addData(“Itemface”,image_set1[image_count][0])
thisExp.addData(“Itemface”, image_set1[image_count][1])