ValueError: 241 is not in list

MacOS Sonoma
PsychoPy 2024.2.0

I have a “listen-identify-rate” task where a participant identifies a vowel sound and then rates it in the following routine. It runs great and has all the features I need, but it keeps crashing unexpectedly during my experimental trials block with an error like what’s in the title. This time it was ‘ValueError: 241 is not in list’, but on the last run it was ‘ValueError: 212 is not in list’.

Fuller error message is:

The line referenced in there appears here, at the end of the loop where it tells the break routine (‘checkEndExp’) to run or not:


There are 8 blocks and it runs without issue most of the time. I’m unclear on the rhyme or reason behind why this isn’t running.

Any ideas? Thanks!

I don’t think you should tell PsychoPy expTrials.finished = False

It might be that when your experiment gets to the end of expTrials then expTrials.finished is set to True but you then set it to False so it crashes when it tries to start the next iteration of the loop and expectedly discovers that there aren’t any more trials left.

Thank you! That does seem to have fixed it.