I have to create an experiment with video and a key press after the video but when i’m testing the code it didn’t close the window at the end ofthe video and it is written “memory error”
this is my code:
Copy or post a screenshot of the complete error message, and your sample code is unformatted and needs to have the correct indentation for people to help. Please put three backticks (```) on the line before and the line after your code when posting here so we can read it, and it comes out looking like this:
Try this (keeping in mind I’ve never used movies in psychopy):
Add this line after your first line:
from psychopy.constants import FINISHED
or this instead:
from psychopy.constants import *
Then change your ‘while’ condition to:
while mov.status != FINISHED:
And I think the win.close() call is unnecessary when you call core.quit().
Unless I’m wrong, the issue is that visual.FINISHED isn’t actually a thing, so your while condition will never be False, and will never end. That’s why you ran out of memory.
Window.__del__() invokes Window.close(), and core.quit() executes sys.exit(), which does not guarantee that any object’s __del__() method – and, hence, Window.close() – actually gets called. Since there’s some cleanup work going on in Window.close(), it’s advisable to always call it before calling core.quit() to ensure “proper” shutdown.
In [1]: from psychopy import constants, visual
In [2]: constants.FINISHED == visual.FINISHED
Out[2]: True
In [3]: constants.FINISHED is visual.FINISHED
Out[3]: True
Thank you ! i actually didn’t know how to put it in form !
The message error is this one :
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\pyglet\media\avbin.py”, line 401, in _process_packet
self._buffered_audio_data.append(audio_data)
MemoryError
To start with, yes, I would switch to MovieStim3 (as in the demos) or MoveiStim2. Both should have superior performance to the one you’re using.
Also, just using the demos do those end their scripts and close their windows (trying to work out if this is about your code or something that’s a bigger problem)