| Reference | Downloads | Github

Can't play videos calling them from excel file

Hi guys,

I’m new to Psychopy. I’m trying to randomly play videos from a specific folder.
I understand that I should create an excel file, and refer to it in the loop under the field “conditions”. Then, under properties of my “movie stimulus”, in “movie file”, I can call my movie directly from my excel file, by writing $file. File is the variable in which I stored the paths of my videos.

That should be it. But when I run the experiment I get the following error:
“TypeError: coercing to Unicode: need string or buffer, type found”

Any idea of what the problem is?


Problem solved. I can’t call my variable “file” :stuck_out_tongue:

1 Like

Hi! Where did you enter $file? I can’t fjghre this out even though I know it should be easy!

Hi Lexi!

  1. Double click the “movie component”.
  2. Movies Properties will open.
  3. In the field “Movie file” place $vid

In your excel file, uploaded under “conditions” of your loop, you should have a column called “vid”. In “vid” you need to place the exact paths to your videos

Hope this helps :slight_smile:

Slight addendum is that where WalkerF says “place the exact paths to your videos” I’d strongly recommend you place “relative” paths i.e. the location of the video relative to the experiment file (*.psyexp).
See chapter 3 of Building Experiments in PsychoPy for more information about filenames in conditions files

1 Like