Memory error using movies under 1.82.01

Hi,

I am using Win 7 64 but and PsychoPy 1.82.01.
I am also using PyGaze.
In my experiment I have a loop of ~20 movies , each one is about a minute length + 3-4 question slides after each movie.
In the middle of the movie (sometimes at the first, sometimes towards the end of the movies) I got :slight_smile:
Memory Error

How can I debug what causes that memory error?
Is PsychoPy “clears” its memory after a movie finished running, so that it shouldn’t affect later movies ?

Thanks
Noa,

this is the error message

I woudl recommend using the much newer MovieStim3 rather than this one. The new one is based on a different library for loading movies and has been much more robust and higher performance.

Hi @Jon, there still seems to be a problem caused by loading the audio within a video; please see my post here: Randomly 'python.exe has stopped working' - After Windows update?
Thanks

Where can I find documentation/examples for movieStim3 ?
I searched and didn’t find any…

@Noa_Slater If you use Coder then the demo on movie and paause_movie both use MovieStim3. It’s a direct replacement for MovieStim so you should be able just to change the name.
If you use Builder then it’s a matter of inserting a movie in the normal way and setting the “backend” to use pymovie rather than avbin but this will be the default on new movies being inserted anyway.

Don’t I need to download different packages etc ?

I searched PsychoPy web and looked in the installation path but couldn’t find those demos.
Where are they ?

Thanks!
Noa

From which version do MovieStim2 and MovieStim3 exist?

The PsychoPy >demos menu in the application!

I can’t keep track of that stuff in my head so we have a detailed changeling here:
Changelog — PsychoPy v2023.2.3

Thanks Jon!

Just one more question - since I am using a older version than 1.83 (which is when MovieStim3 was added. That’s why I couldn’t find its demo) -
Is it possible to add any libraries/files to 1.82.01 version (I understand the library is moviepy) so that I can use MovieStim3 with 1.82.01?

I have a problem migrating to a later version. I did try version 1.84 but my Cedrus box was not working there.

Thank you very much !
Noa

Hi Jon,

I installed 1.84 again so that I would have MovieStim3.
However, ןit runs OK only my first movie. At the point that it should run the second movie , I get the “python.exe has stopped working”:

Traceback (most recent call last):
File “D:\MyExperiments\Rotem\NewEyeLink\split2trials-copy\CocktailPartyWithQuestionsFirstHalf_NoaEdits.py”, line 697, in
mov = visual.MovieStim3(win, movie, flipVert=False)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.84.2-py2.7.egg\psychopy\visual\movie3.py”, line 124, in init
self.loadMovie(self.filename)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.84.2-py2.7.egg\psychopy\visual\movie3.py”, line 181, in loadMovie
jwe_tmp.audio.to_soundarray(),
File “”, line 2, in to_soundarray
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\moviepy\decorators.py”, line 54, in requires_duration
return f(clip, *a, **k)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\moviepy\audio\AudioClip.py”, line 114, in to_soundarray
chunksize=buffersize))
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\numpy\core\shape_base.py”, line 230, in vstack
return _nx.concatenate([atleast_2d(_m) for _m in tup], 0)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\moviepy\audio\AudioClip.py”, line 81, in generator
buffersize=chunksize)
File “”, line 2, in to_soundarray
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\moviepy\decorators.py”, line 54, in requires_duration
return f(clip, *a, **k)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\moviepy\audio\AudioClip.py”, line 127, in to_soundarray
snd_array = self.get_frame(tt)
File “”, line 2, in get_frame
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\moviepy\decorators.py”, line 89, in wrapper
return f(*new_a, **new_kw)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\moviepy\Clip.py”, line 95, in get_frame
return self.make_frame(t)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\moviepy\Clip.py”, line 136, in
newclip = self.set_make_frame(lambda t: fun(self.get_frame, t))
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\moviepy\Clip.py”, line 188, in
return self.fl(lambda gf, t: gf(t_func(t)), apply_to,
File “”, line 2, in get_frame
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\moviepy\decorators.py”, line 89, in wrapper
return f(*new_a, **new_kw)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\moviepy\Clip.py”, line 95, in get_frame
return self.make_frame(t)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\moviepy\audio\io\AudioFileClip.py”, line 71, in
self.make_frame = lambda t: reader.get_frame(t)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\moviepy\audio\io\readers.py”, line 193, in get_frame
"but len(buffer)=%d\n"%(len(self.buffer))+ str(error))
IOError: Error in file D:\MyExperiments\Rotem\NewEyeLink\split2trials-copy\newMoviesFromMatan\A\Condition 5 Take 2.avi, At time t=38.55-39.68 seconds, indices wanted: 100000-145036, but len(buffer)=144906
index 144906 is out of bounds for axis 0 with size 144906

I also tried to run the demos and got “python.exe has stopped working” at the end of the movie (in both “MovieStim” and “Pause MovieStim”) with this error:

portaudio error in Pa_AbortStream: Unanticipated host error
Exception TypeError: “‘NoneType’ object is not callable” in <bound method Server.del of <pyolib.server.Server object at 0x16433430>> ignored

It happens any time I do run it.

How can I proceed ?

Thanks
Noa

I’ve started getting the same error in 1.84.2 as Noa; the error pops up later in the experiment (after the 5th trial), and of course the index/filename/time are different, but I also get the “index out of bounds” error.