| Reference | Downloads | Github

Pavlovia - stuck on initialising experiment

URL of experiment:
Project page:
Browser: Firefox 68.0

Description of the problem:
Hi all,

I am running on PsychoPy 3.1.5 and am trying to sync the Builder experiment to Pavlovia. The experiment can run on the local console, but seems to be stuck on the initialising stage when opened in a web browser.

I have read similar posts and thus checked the presence of my .js file and the naming issue, but they seem to be in place.

Of note is that code components in PY/JS are included. There are probably errors in the JS script as it is my first time writing in this language, but I would need the experiment to run to debug…

Thanks in advance for your help.


Hi, it seems that the expInfo dialog box had some problems popping out, as the firefox web console showed

SyntaxError: missing : after property id
at the line

let expInfo = {u'Parti': u'', u'Age': u'', u'Cond2': u'1', u'Cond': u'1', u'Gender(F/M)': u''};

I thought, oh well, easy enough, and changed it to

let expInfo = {'Parti': '', 'Age': '', 'Cond2': '1', 'Cond': '1', 'Gender(F/M)': ''};

and it worked.

The experiment ‘can run’ in the sense that the dialog box is out. After pressing enter, another error message quickly appears:

ReferenceError: frameDur is not defined

seemingly because no ‘var’ or ‘let’ was put before the code

  if (typeof expInfo['frameRate'] !== 'undefined')
    frameDur = 1.0/Math.round(expInfo['frameRate']);
    frameDur = 1.0/60.0; // couldn't get a reliable measure so guess

Anyway, I changed it to

  if (typeof expInfo['frameRate'] !== 'undefined'){
      var frameDur=1.0/Math.round(expInfo['frameRate']);
  } else {

However, the next thing that prompted ReferenceError is ‘lifeClock’, with ‘life’ being the first routine of the experiment, and ‘lifeClock’ being the first clock being initiatialised

After that, I just added ‘var’ or ‘let’ in front of all assignments that lack it. However, in prepare to start routine part, this line of code does not work

  lifeClock.reset(); // clock

The error raised is ‘lifeClock is not defined’

Is something wrong with my JS compilation?

FYI, the project page where the .js I fiddled with is:
The experiment name is ILxS
Which is in my another account on pavlovia (sorry about that, it was just so that I tried changing everything I can in attempt to put the experiment online)

I appreciate your help.

Hi @Joyce_Tam, the error you are experiencing is the result of a failure to compile the JS code correctly, probably resulting from an error in either a code component, or line of code used in a component. One problem is how you are importing components in your ILxS task, follow the MDN guidelines for correct imports. However, Math module should already be available, and thus so is Math.random().

Regarding the unicode string error, I think this is perhaps a PsychoPy Python 2 issue. If you switch to the Python 3 version this error will go away, but I will also have a look at getting this fixed for Python 2 installations.

Thanks a lot for your reply. The JS script have now been debugged and fixed, and the program is running properly.