Moviestim = None leads to an error message

OS (e.g. Win10): Win10
PsychoPy version (e.g. 1.84.x): 2023.2.3
Standard Standalone? (y/n) If not then what?: y

I’m creating an experiment where I sometimes need to show a movie, and at other times I need to show a picture.

I have specified the paths for the moviefiles and picture files in an excel sheet. I have written None in the trials where no movie or picture should be shown. This works fine when only playing a movie but no picture, but when I get to a trial with a picture but no movie, I get the following error message:

22.3774 EXP New trial (rep=0, index=5): {‘Trial’: 6, ‘Target_Movie’: ‘None’, ‘Picture’: ‘Stimuli/Movies/025c.png’, ‘Correct_response’: 1, ‘File_type’: ‘png’, ‘Set_ID’: ‘1_Test’}
25.1755 EXP window1: mouseVisible = True
3.8961 WARNING Monitor specification not found. Creating a temporary one…
File “C:\Users\Documents\Experiments\recogtest\recog_lastrun.py”, line 748, in
run(
File “C:\Users\Documents\Experiments\recogtest\recog_lastrun.py”, line 510, in run
movie.setMovie(Target_Movie)
File “C:\Users\AppData\Local\Programs\PsychoPy\lib\site-packages\psychopy\visual\movies_init_.py”, line 174, in setMovie
self.loadMovie(value)
File “C:\Users\AppData\Local\Programs\PsychoPy\lib\site-packages\psychopy\visual\movies_init_.py”, line 216, in loadMovie
raise FileNotFoundError(“Cannot open movie file {}”.format(
FileNotFoundError: Cannot open movie file None
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001d41f904300] stream 0, timescale not set
ioHub Server Process Completed With Code: 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001d453a1d6c0] stream 0, timescale not set
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001d455564a00] stream 0, timescale not set
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001d457dca900] stream 0, timescale not set
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001d453908780] stream 0, timescale not set
################ Experiment ended with exit code 1 [pid:10504] #################

Hello

there are two problems with this approach.

  • None is a reserved word in Python, see here Python None Keyword
  • With your approach, PsychoPy tries to load a picture/movie called None which does not exist.

You could create a routine showing your stimulus and make the execution of the routine conditional.

Best wishes Jens

Thank you for your reply. I was just wondering why it doesn’t work, as works for images.

Best, Katrine

Hello

The best way to find out why None does not work for movies but does for images is to post a issue on github GitHub - psychopy/psychopy: For running psychology and neuroscience experiments.

Best wishes Jens