| Reference | Downloads | Github

Loop always crashes at 2nd trial of 3rd block

If this template helps then use it. If not then just delete and start from scratch.

OS (e.g. Win10): WIN10
PsychoPy version (e.g. 1.84.x): 2020.2.10
Standard Standalone? (y/n) If not then what?: y
**What are you trying to achieve?: I try to build an experiment with 3 blocks, and each block consists of 4 trials. Every trial involves a video stimulus and a key reaction press. The order of the blocks and trials is random. This seems to work. But, every time I try to run the experiment, it crashes at the 2nd trial of the 3rd block. The video won’t start, the screen freezes. As both the order of the blocks and trials is random, the crash isn’t caused by one specific video file.
video files are 1920x1080, 30fps, about 5 minutes.

What did you try to make it work?: I lowered the resolution of the video files, but this didn’t result in better performance.

What specifically went wrong when you tried that?: still the same crash/freeze

Include pasted full error message if possible. “That didn’t work” is not enough information.

Hi There,

I notice that you are using an older version of PsychoPy, the first thing we always suggest is trying an upgrade if possible. Many bugs/issues tend to get sorted in follow up releases!

Please can you try an upgrade and see if the error persists.


Hi Becca,

Thank you for your suggestion. I installed the newest version of psychopy. When I open my experiment and try to run it, I get a lot of warnings and errors. So that doesn’t help me. But I will try to build the experiment from scratch in the new version. And see whether that helps. I hope so.



Unfortunately updating to then newest version of psychopy doesn’t help. It still gets stuck. The experiment seems to freeze. I get a warning window saying “Python is not responding” and two buttons to choose from: waiting or closing python.

Strangely, my code to pause the video stimuli doesn’t work properly in the newest psychopy version. While it worked fine in the older version. In the new version, pressing space only pauses the audio and not the video. But it does print pausing or stopping and the correct time. And pressing the right button stops the video perfectly fine. I used this code (which I found on a forum):

for key in event.getKeys():
    if key in ['escape', 'q']:
    elif key in ['space', ]:
        # To pause the movie while it is playing....
        if mov.status == PLAYING:
            print (t)
    elif key in ['right', ]:
        # To stop the movie if pause has been called...
        if mov.status == PAUSED:
            print (t)

Does anyone knows what goes wrong?

Hi There,

OK thank-you for trying that. I am guessing that your basic trial structure (by basic I mean movie presentation only, with no keyboard responses etc. added yet) appears something like in this demo? moviePauseDemo_basic.psyexp (11.7 KB)
Using a conditions file that looks something like this:
movie_conditions.xlsx (8.6 KB)

If so, please could you check if this works with some of your movie files? This will help first check that the freezing is not due to the movie files themselves.


Note: tackling this before approaching the code component side of things!

Hi Becca,

Thank you for your quick reply. I tried your demo files. The videos start playing after 2-3 seconds waiting time. They seem to look normal, but I get these warnings.

Running: C:\Users\mm0086515\Desktop\Experiment folder Basketbal\

14318.8658 INFO Loaded monitor calibration from [‘2021_01_07 14:43’]
pygame 1.9.6
Hello from the pygame community. Contribute - pygame wiki
8.1712 WARNING User requested fullscreen with size [1280 800], but screen is actually [1920, 1080]. Using actual size
19.0641 WARNING 0.17101856670342386: Video catchup needed, advancing self._nextFrameT from 0.06666666666666667 to 0.1
19.0641 WARNING 0.17105666670249775: Video catchup needed, advancing self._nextFrameT from 0.1 to 0.13333333333333333
19.1295 WARNING 0.23639366670977324: Video catchup needed, advancing self._nextFrameT from 0.16666666666666666 to 0.19999999999999998
257.1933 WARNING 238.30019536666805: Video catchup needed, advancing self._nextFrameT from 238.23333333332238 to 238.2666666666557
282.6282 WARNING 263.73506496672053: Video catchup needed, advancing self._nextFrameT from 263.6666666666608 to 263.69999999999413
283.8298 WARNING 264.93530016671866: Video catchup needed, advancing self._nextFrameT from 264.86666666666173 to 264.8999999999951
283.8985 WARNING 265.0054281667108: Video catchup needed, advancing self._nextFrameT from 264.93333333332845 to 264.9666666666618
283.9666 WARNING 265.0734537667013: Video catchup needed, advancing self._nextFrameT from 264.99999999999517 to 265.0333333333285
284.0296 WARNING 265.13650906668045: Video catchup needed, advancing self._nextFrameT from 265.0666666666619 to 265.09999999999525
284.1274 WARNING 265.23431536671706: Video catchup needed, advancing self._nextFrameT from 265.16666666666197 to 265.1999999999953
284.1275 WARNING Max reportNDroppedFrames reached, will not log any more dropped frames
646.6472 WARNING 274.8734227666864: Video catchup needed, advancing self._nextFrameT from 274.80000000000297 to 274.8333333333363
646.7207 WARNING 274.9469106666511: Video catchup needed, advancing self._nextFrameT from 274.8666666666697 to 274.90000000000305
646.9081 WARNING 275.13438496668823: Video catchup needed, advancing self._nextFrameT from 275.06666666666985 to 275.1000000000032
1284.5226 WARNING 285.66859736666083: Video catchup needed, advancing self._nextFrameT from 285.60000000001156 to 285.6333333333449

Experiment ended.

Hi There,

is that 2-3 second waiting time expected? how long is each video you are presenting?

The warning about using actual size is ok (there is no value in the size field because of this known issue). The warning about video catch up might be indicative that you are dropping some frames - did the movie appear jittery in any way?

I am not sure why I get the waiting time. (in the older version of psychopy it was often 5-7sec waiting time). the video files are about 5 minutes. They didn’t appear jittery.

Aha ok. That wait time will be because these videos are quite large, it might be worth considering preloading the videos - is the 2-3 seconds load time going to be problematic for your study? and - returning to your original bug, may I ask if these videos progress past the point where the crashing was happening before?


Hi Becca,

Apologies for the late response. I included all my videos in your demo. The videos are all played then. So I think the problem is not in the video files itself.
The 2-3 second loading time is not so problematic, but it shouldn’t be more than that. How do I preload the videos?


Hi there, I am having a similar issue. Becca will remember me from troubleshooting code to present movie stimuli weeks ago :slight_smile: I have now coded a task that produces no errors and occasionally makes it through all the way with no issues, but more often than not crashes in the middle of the task with no errors and without saving any output to my .csv file. It’s something specific with video files, as my other PsychoPy tasks created in the same version and run on the same MacOS on the same laptop don’t present any issues.