Outer loop completes full cycle on the first pass but then freezes midway through the second pass (when an inner loop is meant to start). In builder

OS (e.g. Win10): OS Version 10.
PsychoPy version (e.g. 1.84.x):
Standard Standalone? (y/n) If not then what?:
What are you trying to achieve?:

In my experiment, for 1 trial, I’m presenting 6 30-second videos randomly and consecutively (in Knee_Pain_Trial1). This is done using a code component as I preloaded the videos at the beginning of the experiment to avoid lagging. I did this using code from this forum…

And what it looks like for my experiment:

I then want to repeat this trial 6 times (which I’ve attempted to do using the Repeats6 loop).

The issue I’m having is when the experiment attempts to run the second trial (I have no issue with the first trial), it freezes and becomes unresponsive after I press a key to finish the waiting_for_scanner routine (just before the inner loop is meant to start). I know it is something to do with the code component controlling the movies in the knee_pain_trial1 routine because when I disable it, the loop runs.

Unfortunately, I don’t have an error message as I have to close the screen for it to stop. I’m new to psychopy and coding so if anyone has suggestions about how to solve this I’d be forever appreciative!

I’ll also upload my psychopy experiment.
Knee_pain_study_2022_02.psyexp (26.0 KB)

Hi @sam2,

You can actually load your videos using a static component (you can find this under Custom > Static). This can be done during any period where nothing is being updated in your experiment, for example a fixation period or a message displayed to participants. You can then just use a standard conditions spreadsheet to load in your different conditions, and a movie component to present your movie stimuli. This will also allow you to use non-slip timing (when this is being used your routine will be green), as I’ve noticed you’re using fMRI I think?


Hi Kim,

Thanks for responding!

I’ve tried using the static component and have been unsuccessful. I’ve tried having the videos loaded before the experiment (in a Preloading Component). The Movie component in my trial will run the first video but won’t run the next 5 videos. This is the error I get…

“/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/visual/movies/players/ffpyplayer_player.py”, line 748, in _assertMediaPlayer
raise RuntimeError(
RuntimeError: Calling this class method requires a successful call to load first.

The only way I’ve been able to get the static component working is if I have it in the same loop as my trial. The problem is then the videos won’t play consecutively (instead the preloading component plays in between the movies).

It’s possible I’m using the static component wrong? If you have any ideas of where it can go so, (1) it will preload all videos in my conditional file before starting my trial and (2) the movie component will then play the 6 videos consecutively (without pauses), that would be very helpful.


Hi @sam2,

Would you mind attaching the folder containing your experiment file and its resources as a .zip file here for me to take a look at this in a bit more detail?



Hi Kim,

The video files were too larger to all be uploaded (even just 1 video zipped wouldn’t upload). I’ll attach my experiment and conditions file. For the videos (if you wanted) you could download a free stock video as a placeholder (and duplicate it 5 times) to represent 6 videos…I found this site.

Also totally understand if this is too much effort!

Psychopy_2022.zip (11.2 KB)