URL of experiment: Pavlovia
Description of the problem: I used the crib sheet to code the beginning of my experiment. I looked through my previous mistakes as well as another online study I got to work on Pavlovia earllier, however I cannot seem to find why this experiment is stuck at initialising. I would really appreciate any insights as to why this may happen.
Thank you!
What error do you get in the console?
Thanks for you quick reply, @wakecarter ! I get the following error:
â159.2902 ERROR Line 2719: Unexpected end of input in KidSpatialMem.js.
Alert 4210:JavaScript Syntax Error in âBegin JS Routineâ tab. See âLine 12: Unexpected end of inputâ in the âBegin JS Routineâ tab. For further info see 4210: Probable syntax error detected in your JavaScript code â PsychoPy v2020.2â
When I look at line 12, it isnât anything I typed, there are import statements there however itâs just the psychopy code. Line 2719 does not show up/exist. In my coder view it ends at 1110.
Specifically, the piece of code that starts at line 12 is:
âfrom subprocess import (
call,
Popen,
PIPE
)â
Are you sure that thatâs line 12 of your JS file. Mine look more like:
ï»ż/******************************
* Change Detection Rsvp Test *
******************************/
import { PsychoJS } from './lib/core-2020.2.js';
import * as core from './lib/core-2020.2.js';
import { TrialHandler } from './lib/data-2020.2.js';
import { Scheduler } from './lib/util-2020.2.js';
import * as visual from './lib/visual-2020.2.js';
import * as sound from './lib/sound-2020.2.js';
import * as util from './lib/util-2020.2.js';
//some handy aliases as in the psychopy scripts;
const { abs, sin, cos, PI: pi, sqrt } = Math;
const { round } = util;
Sorry, I was looking at the coder view. I just opened the js file thatâs on Pavlovia and mine looks similar to yours:
Iâm still having a hard time seeing what is going wrong. I am not a good or efficient coder so I really wouldnât be surprised if I am missing something obvious!
Is there a reason why you are still using version 2020.1?
No, I was working from the lab computer and not my personal one which is probably why it wasnât updated. I just downloaded the latest version and synced, but I still seem to be having the same problem!
If the error is still mentioning 2020.1 then switch the experiment to inactive and then activate it again.
I switched the experiment, then downloaded it from Pavlovia since Pavlovia does not give me an error message, it just stays on âinitialising experimentâ. I tried to run what I downloaded locally and got the error:
âAlert 4210:JavaScript Syntax Error in âBegin JS Routineâ tab. See âLine 12: Unexpected end of inputâ in the âBegin JS Routineâ tab.
For further info see 4210: Probable syntax error detected in your JavaScript code â PsychoPy v2021.2
Alert 4210:JavaScript Syntax Error in âBegin JS Routineâ tab. See âLine 12: Unexpected end of inputâ in the âBegin JS Routineâ tab.
For further info see 4210: Probable syntax error detected in your JavaScript code â PsychoPy v2021.2â
When I open the js file, this is what is on line 12:
What you need to do in this situation is look in the Developer Console (Ctl-Shift-I) for the error message. I think the error message you are reporting is caused by testing a remote js file locally.
1 Like
Thank you very much for telling me where to look, I was having a hard time making sense of the error! Now that Iâve done that, I get a 404 error (Failed to load resource) as well as âunexpected end of inputâ (uncaught syntax error.) I believe the syntax error message is mentioning line 2709, I donât have that line on my js file, but I have the end very close to it. I included the screenshots.
I took a look at the crib sheet, for endings since it mentions end of input at the end of the experiment. My final event is just a âthank youâ text that has 5 seconds duration.

Is there anything I needed to add to the end to make this work? Now Iâm questioning everything I did!
This error implies an unbalanced bracket or similar.
I would recommend that you check that none of your auto translated code components have syntax error displayed, then check Both and JS code components very carefully (possibly via recreating Both components from their Auto versions), then check any other components that have none trivial code in them.