| Reference | Downloads | Github

Stuck on "initialising experiment..." using movies as stimuli

URL of experiment:

Gitlab repository: Sign in · GitLab

Using: Win 10, PsychoPy v3.2.4

Description of the problem:

Hi all,

I am trying to sync the Builder experiment to Pavlovia and I have 3 other experiments that are very similar and are working already (pilot mode), here are the links:

The only difference is that here I use movies whereas in the others I use images. I found a post saying it could be because of .avi extension incompatibilities, so I converted to the recommended .mp4, but it still hasn’t worked. I also tried using different sizes for the movies, but I don’t think this is the problem. It works fine offline and I have no code component, so I think it cannot be a problem with “import”.
Also, in the console I have this error:

I have read similar posts but couldn’t solve it, and any help would be much appreciated.

Thanks in advance for your help!


I’m seeing an error in the line containing name: ‘movie_left’ in :

  //------Prepare to start Routine 'trial'-------
  t = 0;
  trialClock.reset(); // clock
  frameN = -1;
  // update component parameters for each repeat
  movie_leftClock = new util.Clock();
  movie_left = new visual.MovieStim({
    win: psychoJS.window,
    name: 'movie_left', units='norm',
    movie: obj1,
    pos: [(- 0.5), 0],
    size: [0.5, 0.5],
    ori: 0,
    opacity: 1,
    loop: true,
    noAudio: false,

Are you defining the movie in a code component or a Builder movie component? If a code component then I think that the issue is that you are creating the movie in Begin Routine rather than Begin Experiment. I haven’t tested movies myself yet, but I found that ShapeStims had to be defined in Begin Experiment so I suspect this is true of movies too.

Perhaps the issue is that you are attempting to create multiple movie components, all with the same name.

Hi, thank you for your response! I am not using code components, it’s 2 Builder movie components (movie_right and movie_left).

Sorry for the silly question but I am very new to this, how are you able to pinpoint the location of the error?

Use Developer Tools (Ctl-Shift-I in Windows/Chrome, Cmd-Opt-J in Mac/Chrome, F12 in IE/Edge, Ctrl-Shift-J in Windows/Safari, Ctrl-Opt-J in Mac/Safari) to view errors via the browser console if you aren’t getting sufficient information from PsychoPy. You can add console.log(var); to your Javascript to check the value of a variable var at a particular point.

1 Like

Hi, thank you for you help, and I am sorry to bother you again.

You were right about the error being in this line, it is also happening in the silliest experiment I designed using my movies and movie components in Builder:
The .js file is being created, but there is still an error in this line. I changed to different unit types, so it does not seem to be the problem.

Here is the URL:

Would you have any idea what could be wrong?

Thank you for all your help!

I found the solution here:

"Hi @tim, this is a syntax error in the JS code compiler. It relates to the units param used for your movie stim. This was a bug that has been fixed for the next release of PsychoPy, but in the mean time, I suggest you either set the units to “from exp settings” and resize your video accordingly, or manually edit the JS code to fix the syntax error (specifically line 305 where the units are set for the movie stim). To do this, you will need to do the following:

  1. Go to Experiment Settings > Online and set “Export HTML” to “manually”
  2. Open your JS file (found in the HTML folder) and change line 305 so units in the movie stim are set using a colon, not an equals sign e.g., should be units : 'cm' .
  3. Save file and resync with Pavlovia

If you choose to manually edit the file, then two things to remember. 1) if you make changes to the experiment, you will have to manually recompile the experiment so the new changes are written to the JS (done using the File > Export HTML from Builder), 2) your manual changes will be overwritten if you recompile your task."