OS (e.g. Win10): Win10
PsychoPy version (e.g. 1.84.x): 2022.1.3
Standard Standalone? (y/n) If not then what?: y
Error report: I am trying to conduct an experiment that includes sound and video files. The experiment usually works, but occasionally crashes at the first presentation of either the sound or video files, claiming that the files are not there or are an incorrect format.
Basically, the experiment sometimes, but not always (or even usually) crashes at the first sound or video. Regardless, my RAs are always able to restart the program and it works successfully the second time around. That’s fine for the sound files (which happen at the beginning of the study, so restarting is no problem) but can be disastrous with the video files (which happen somewhere in the middle). I’m not entirely sure if it’s the exact same issue for each, but I thought I’d bundle the error reports together.
Here’s an example of a sound file error that happens on crash:
File “C:\Users\cast.cspanlab\Box\CSPAN Lab General\Experiments\Implementations\Armenia\A7P01_lastrun.py”, line 94, in
pre_wav = sound.Sound(‘Stimuli/Sounds/puppies_1_dn_62_100_norm.wav’, secs=1.0, stereo=True, hamming=True,
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\sound\backend_ptb.py”, line 331, in init
self.setSound(value, secs=self.secs, octave=self.octave,
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\sound\backend_ptb.py”, line 426, in setSound
_SoundBase.setSound(self, value, secs, octave, hamming, log)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\sound_base.py”, line 200, in setSound
self._setSndFromFile(p)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\sound\backend_ptb.py”, line 429, in _setSndFromFile
self.sndFile = f = sf.SoundFile(filename)
File “C:\Program Files\PsychoPy\lib\site-packages\soundfile.py”, line 629, in init
self._file = self._open(file, mode_int, closefd)
File “C:\Program Files\PsychoPy\lib\site-packages\soundfile.py”, line 1183, in _open
_error_check(_snd.sf_error(file_ptr),
File “C:\Program Files\PsychoPy\lib\site-packages\soundfile.py”, line 1357, in _error_check
raise RuntimeError(prefix + _ffi.string(err_str).decode(‘utf-8’, ‘replace’))
RuntimeError: Error opening ‘Stimuli/Sounds/puppies_1_dn_62_100_norm.wav’: File contains data in an unknown format.
################# Experiment ended with exit code 1 [pid:9940] #################
And for the video file error:
Traceback (most recent call last):
File “C:\Users\cast.cspanlab\Box\CSPAN Lab General\Experiments\Implementations\Armenia\A7P01_lastrun.py”, line 1619, in
stim_a_mp4 = visual.MovieStim3(
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\contrib\lazy_import.py”, line 118, in call
return obj(*args, **kwargs)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\visual\movie3.py”, line 139, in init
self.loadMovie(self.filename)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\visual\movie3.py”, line 248, in loadMovie
raise IOError(“Movie file ‘%s’ was not found” % filename)
OSError: Movie file ‘Stimuli/Images/puppies_1_dn_70_140_visl.mp4’ was not found
Exception ignored in: <function MovieStim3.del at 0x0000017AD0EF3CA0>
Traceback (most recent call last):
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\visual\movie3.py”, line 571, in del
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\visual\movie3.py”, line 548, in _unload
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\visual\basevisual.py”, line 1188, in clearTextures
OSError: exception: access violation reading 0x0000000000000000
################ Experiment ended with exit code 1 [pid:10220] #################
There is nothing wrong with the files themselves. Like I said, the experiments usually work! So the sound and video files work just fine in other contexts; they are there in the directory listed and PsychoPy can find them other times.