Psychopy: Using MovieStim3 for a video rating task crashes with: “[Errno 24] Too many open files”

Created on 3 Oct 2018  Â·  12Comments  Â·  Source: psychopy/psychopy

Maybe it is more appropriate to report this here: Based on the error message I suspect that MovieStim3 doesn't close opened files properly? What could be done to close the files after displaying them and hence (hopefully) avoid this error (and crash)?

OS (e.g. Win10): Windows XP (but crash also occurs on MacOS High Sierra, though without producing an error message - on the Mac PsychoPy simply freezes)

PsychoPy version (e.g. 1.84.x): 1.90.2 (on both platforms)

Standard Standalone? (y/n) Y. Standalone versions as provided on the web site for both, Win XP and MacOS High Sierra

What are you trying to achieve?: I've set up a task using builder where participants have to rate videos (n = 300) on a Likert scale. Roughly halfway through the task PsychoPy crashes and produces the error message given below.

What did you try to make it work?: I've tried setting up a minimal working example containing just one routine that is repeated 300 times, playing the clip and then displaying a scale. Even in this simplistic scenario PsychoPy crashes halfway through.

What specifically went wrong when you tried that?: Complete error message:

Running: D:\Lab_pc_9_trajanvideo_ratings\rate_videos.py

4.6403 WARNING Monitor specification not found. Creating a temporary one...
16.3675 WARNING User requested fullscreen with size [1024 768], but screen is actually [1680, 1050]. Using actual size
17.7338 ERROR Error in framebuffer activation
17.7338 WARNING Framebuffer object (FBO) not supported on this graphics card
Traceback (most recent call last):
File "D:\Lab_pc_9_trajanvideo_ratings\rate_videos.py", line 1086, in
File "C:\Program Files\PsychoPy2libsite-packages\psychopyvisual\movie3.py", line 134, in __init__
File "C:\Program Files\PsychoPy2libsite-packages\psychopyvisual\movie3.py", line 180, in loadMovie
File "C:\Program Files\PsychoPy2libsite-packages\moviepyvideo\io\VideoFileClip.py", line 81, in __init__
File "C:\Program Files\PsychoPy2libsite-packages\moviepyvideo\io\ffmpeg_reader.py", line 32, in __init__
File "C:\Program Files\PsychoPy2libsite-packages\moviepyvideo\io\ffmpeg_reader.py", line 256, in ffmpeg_parse_infos
File "C:\Program Files\PsychoPy2libsubprocess.py", line 745, in __init__
OSError: [Errno 24] Too many open files
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "C:\Program Files\PsychoPy2libatexit.py", line 24, in _run_exitfuncs
File "C:\Program Files\PsychoPy2libsite-packages\psychopy\data\experiment.py", line 366, in close
File "C:\Program Files\PsychoPy2libsite-packages\psychopy\data\experiment.py", line 351, in saveAsPickle
File "C:\Program Files\PsychoPy2libsite-packages\psychopytools\filetools.py", line 149, in openOutputFile
File "C:\Program Files\PsychoPy2libcodecs.py", line 896, in open
IOError: [Errno 24] Too many open files: u'D:\Lab_pc_9_trajan\video_ratings\data/test_rate_videos_2018_Sep_28_1556.psydat'
Error in sys.exitfunc:
Traceback (most recent call last):
File "C:\Program Files\PsychoPy2libatexit.py", line 24, in _run_exitfuncs
func(targs, *kargs)
File "C:\Program Files\PsychoPy2libsite-packages\psychopy\data\experiment.py", line 366, in close
self.saveAsPickle(self.dataFileName)
File "C:\Program Files\PsychoPy2libsite-packages\psychopy\data\experiment.py", line 351, in saveAsPickle
fileCollisionMethod=fileCollisionMethod) as f:
File "C:\Program Files\PsychoPy2libsite-packages\psychopytools\filetools.py", line 149, in openOutputFile
f = codecs.open(fileName, mode=mode, encoding=encoding)
File "C:\Program Files\PsychoPy2libcodecs.py", line 896, in open
file = __builtin__.open(filename, mode, buffering)
IOError: [Errno 24] Too many open files: u'D:\Lab_pc_9_trajan\video_ratings\data/test_rate_videos_2018_Sep_28_1556.psydat'

waiting for feedback

All 12 comments

There were a couple of fixes to MovieStim3 in the summer:
https://github.com/psychopy/psychopy/commits/master/psychopy/visual/movie3.py

Could you try using the latest version of that file:
https://github.com/psychopy/psychopy/blob/master/psychopy/visual/movie3.py
(or the 3.0.0 beta of PsychoPy) to see if this is already fixed?

I tried using PsychoPy3_PY2 v3.0.0b10 but now no video will play at all; the minimal working example script crashes when it tries to load the first video:

#### Running: D:\Lab_pc_18_zeissvideo_rating\test\test.py

6.6901 WARNING User requested fullscreen with size [1024 768], but screen is actually [1680, 1050]. Using actual size
7.3675 ERROR Error in framebuffer activation
7.3675 WARNING Framebuffer object (FBO) not supported on this graphics card
Traceback (most recent call last):
File "D:\Lab_pc_18_zeissvideo_rating\test\test.py", line 105, in
depth=0.0,
File "C:\Program Files\PsychoPy3_PY2libsite-packages\psychopycontriblazy_import.py", line 120, in __call__
return obj(args, *kwargs)
File "C:\Program Files\PsychoPy3_PY2libsite-packages\psychopyvisual\movie3.py", line 134, in __init__
self.loadMovie(self.filename)
File "C:\Program Files\PsychoPy3_PY2libsite-packages\psychopyvisual\movie3.py", line 180, in loadMovie
self._mov = VideoFileClip(filename, audio=(1 - self.noAudio))
File "C:\Program Files\PsychoPy3_PY2libsite-packages\moviepyvideo\io\VideoFileClip.py", line 91, in __init__
fps_source=fps_source)
File "C:\Program Files\PsychoPy3_PY2libsite-packages\moviepyvideo\io\ffmpeg_reader.py", line 33, in __init__
fps_source)
File "C:\Program Files\PsychoPy3_PY2libsite-packages\moviepyvideo\io\ffmpeg_reader.py", line 269, in ffmpeg_parse_infos
if "No such file or directory" in lines[-1]:
IndexError: list index out of range
Exception WindowsError: 'exception: access violation reading 0x00000000' in > ignored

I tried creating a new experiment using the PsychoPy3 coder that was just supposed to play a video file and it produced the same error message.

Lastly, replacing just movie3.py in my installation of PsychoPy2 also didn't work.

Ouch! OK, I'll need to look into that :-/

Okay, that'd be great! I'm trying to use PsychoPy for rating video files, so this bug is extremely annoying as it makes the PsychoPy practically unusable for my purposes. :/

Hi there. I've just worked out why video wasn't working in recent versions on some graphics cards, so hopefully that will fix the problem.

Hi, that sounds very promising. Is there any way in which I can test the fix to see whether it resolves the issue?

You could download the current source of these 2 files from github

  • psychopy/visual/window.py
  • psychopy/visual/movie3.py

or you could wait for the new standalone distros, which I'm currently testing

@trettenbrein Has this been fixed for you?

@trettenbrein Has this been fixed for you?

When I last checked in October it still wasn't working, so I ended up not using PsychoPy for this task. (Which is why I haven't looked into this since.)

I currently don't have access to the computers were these problem occurred (neither the Mac nor Windows machines), but I'd be happy to look into this again in a few weeks (beginning of January), if you want me to?

Hi @trettenbrein, that would be nice of you, yes! :)

My apologies, I totally forgot about this and only now stumbled upon the open issue again. I just tried to run the old script with PsychoPy 2020.2.4 and had no issues, so this seems to have been fixed in the new version as suggested by @peircej.

Many thanks Patrick

Was this page helpful?
0 / 5 - 0 ratings

Related issues

janfreyberg picture janfreyberg  Â·  12Comments

trettenbrein picture trettenbrein  Â·  5Comments

laurentperrinet picture laurentperrinet  Â·  4Comments

lucaf picture lucaf  Â·  13Comments

janfreyberg picture janfreyberg  Â·  7Comments