Builder creates movie.stop() which crashes program

OS: macOS Monterey 12.7.6
PsychoPy version: 2022.2.5
Standard Standalone Installation? (y/n): Yes
Do you want it to also run online? (y/n): No
What are you trying to achieve?:

I am trying to code a block fMRI design that has 4 runs of 10 trials each, displaying ~15s (football) videos between fixation crosses. However, my builder program produces two instances of movie.stop(), with the second causing the program to crash after the first video has displayed. If I edit the compiled .py script directly and remove the second movie.stop() instance, the program works perfectly, yet the builder will always add this erroneous line.

What did you try to make it work?:

When I troubleshoot with text components rather than movie components, it works perfectly.

When I removed the outside ‘runs’ loop, which selects which rows from a trialSequence.xlsx, it still breaks down. If I further remove the inside ‘trials’ loop, the compile produces 2 movie.stop()'s, yet runs (1 video) without error. Perhaps the issue is coming from this loop?

In fact, when I use a regular no-condition 5-repeat trial loop, it works fine too (though obviously not cycling through videos). When I ask it to cycle through the spreadsheet, it mostly works, though sometimes it will crash in the same way, but after a random video rather than the first. Perhaps the issue arises from the outside ‘runs’ loop deciding the rows of the inside ‘trials’ loop?

The internet says that I should untick ‘Stop with Routine?’ on the Movie as this will stop the builder from putting a second movie.stop(), however, I cannot find this option in Movie Properties> Playback. Is it possible Psychopy 2022.2.5 doesn’t have it?

What specifically went wrong when you tried that?:
File “/Users/Sam/Desktop/Work_Experience/BUCNI/Fred_Football/Basic/footballBasic_lastrun.py”, line 531, in
movie.stop()
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/visual/movies/init.py”, line 346, in stop
self._player.stop(log=log)
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/visual/movies/players/ffpyplayer_player.py”, line 831, in stop
raise RuntimeError(“Cannot close stream, not opened yet.”)
RuntimeError: Cannot close stream, not opened yet.

Two movie.stop() instances in the compile:

Do you have anything in the movie duration field? Could you remove it (and have a movie of the right length or stop the routine when you want to stop the movie)?

Yes! I had $movieTime in the duration field (though it also crashed when filled with a constant), and when I removed that, it worked fine! Looking at the compile, this removes the first movie.stop() from my original.

Surely if I have no set duration, I will not have non-slip timings, though?

That’s probably true – I assume there is a reason why you can’t update to a version with Routine Settings where you can give the routine a non-slip time as a whole. You could try creating non-slip timing by adding Each Frame code to compare tThisFlipGlobal with the expected end time of the routine.