Raise RuntimeError(“Cannot close stream, not opened yet.”)


This is my overall task:

In this task, people see a movie for a randomly varied time before responding to a visual analog scale (VAS).
Details of the task and how it is coded are here: Breakdown after stimulus random stop - #10 by Ange. Or right away here the psychopy task:
EmpathySTUDY.zip (77.7 KB)
One movie stimuli example is here: e.mp4 - Google Drive

What specifically went wrong ?:
After the movie, the experiment breaks down with the error

raise RuntimeError(“Cannot close stream, not opened yet.”)

Online I don’t find much about this error… In the VAS routine, I added the following code in the Start section, but it does not help…

Happy for any suggestions… Thanks a lot in advance :slight_smile:

Was a solution ever found to this? I am having the exact same issue, although changing the duration to a number (like in your previous post) doesn’t work for me.

No, no solution found so far…

It looks like the call to movie.stop is being reached before movie.start - what version of PsychoPy are you running in?

I found a solution in my experiment (thanks to some help from colleagues)! I had to change the duration of the videos in the Excel sheet to be a little longer than the actual video duration. I added two seconds, but you can probably play around with it in your experiment. We think this is necessary because the video takes some time to buffer and so you need to include that in your duration time. Hopefully this helps!

I tried different versions of the possibilities below:

It is not working in any of those I tried…

The thing is that is pays the movie as long as I want it, but it does not pass to the next routine which is a text component with a slider.

I got the answer here:

The solution is to:

  1. Remove $stim_dur from the duration of the movie (make it blank)
  2. Add the following code to Each Frame
if t > stim_dur:
     continueRoutine = False