If this template helps then use it. If not then just delete and start from scratch.
OS (Win11):
PsychoPy version (v 2026.2.2.):
Standard Standalone Installation? y
Do you want it to also run online? n
What are you trying to achieve?
Run a loop twice, then continue with the rest of the experiment.
What did you try to make it work?:
The loop contains a sequence of 4 trials. Each line in the conditions file (“CongrPract.csv”) specifies the parameters for each of the four trials (Congr1, Arrow1, XPos1, YPos1, CorrAns1, Congr2, Arrow2… etc. until CorrAns4). The conditions file contains four of these lines, thus, running through the loop once creates 16 trials for the participant, running through the loop twice creates 32 trials, and so on.
The loop is set to FullRandom, and IsTrials is selected.
Loop:
Conditions file:
What specifically went wrong when you tried that?:
When I set Num. Repeats to 1, the experiment runs perfectly: the loop completes and the program moves on to the next component (“FeedbackPract”).
However, when I set Num. Repeats to 2, the experiment crashes AFTER it has completed the loop twice, but before it reaches the next component.
The full list of warnings and error messages is
Traceback (most recent call last):
17.0975 WARNING psychopy.parallel has been imported but no parallel port driver found. Install either inpout32, inpoutx64 or dlportio
File “C:\Users\pssdb\OneDrive\Simon8Alt.py”, line 10690, in
run(
File “C:\Users\pssdb\OneDrive\Simon8Alt.py”, line 3346, in run
Pract1.saveAsExcel(filename + ‘.xlsx’, sheetName=‘Pract1’,
File “C:\Users\pssdb\OneDrive\PsychoPy\lib\site-packages\psychopy\data\base.py”, line 324, in saveAsExcel
dataArray = self._createOutputArray(stimOut=stimOut,
File “C:\Users\pssdb\OneDrive\PsychoPy\lib\site-packages\psychopy\data\trial.py”, line 1496, in _createOutputArray
thisLine.append(self.trialList[stimN][heading])
IndexError: list index out of range
20.0511 WARNING User requested fullscreen with size [1680 1050], but screen is actually [1920, 1080]. Using actual size
######## Experiment ended with exit code 1 [pid:30012] #########
Because this suggested that the problem is with the “saveAsExcel” command, I deselected “Save excel file” from the experiment parameters. Unfortunately, this made no difference: the program still crashed after running through the loop twice, the error message was still “IndexError: list index out of range”.
Any help would be greatly appreciated!
Thanks,
Friederike
Links to posts reporting similar problems:
Experiment Index Error : list index out of range - Builder - PsychoPy


