Pavlovia - stuck on initialising experiment

URL of experiment: https://run.pavlovia.org/joyjoycemyt/newtest/html/
Project page: https://gitlab.pavlovia.org/joyjoycemyt/newtest
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.

Best,
Joyce

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']);
  else
    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 {
      frameDur=1.0/60.0;
  }

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: https://gitlab.pavlovia.org/user1109/ilxs
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.

Hi,

I am having the same problem - 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 the experiment when opened in a web browser (I use Google Chrome).

I am not sure how to fix this, because I am new to the programming - thanks in advance for your help.

Regards,
Klara

URL of experiment: https://run.pavlovia.org/Klara/baserate/html/
Project page: https://gitlab.pavlovia.org/Klara/baserate

Hello,

You should totally wait for the pro to look into your code and reply, but my experience is that, when there are syntax errors in the JS code, it will be stuck on the initializing page. You can debug the code from the web console of the browser (when you open the web console it will tell you what kind of error it is experiencing and which line in the code is responsible for that error).

Hope that your experiment can run soon.

Best,
Joyce

Thanks a lot. I have fixed the syntax error, but now it’s stuck on synchronizing the project to Pavlovia for over 30 minutes. Does anyone know how to fix this problem?

Kind regards,
Klara

Hi all,

I am experiencing this issue too. My experiment runs fine in PsychoPy, but will only reach the ‘initialising’ page when I try to run it online. I checked in the browser console, but it just says ‘unexpected syntax error’, so does not help in identifying where the error might be.

I am very new to PsychoPy and coding, so could anyone offer a solution?

URL of experiment: PhD experiment version 1A [PsychoPy]

Thanks so much
Virginia

My Browser console sys SyntaxError: Unexpected token ‘*’ and refers to the line: import * as random from ‘random’;

I’m afraid that you can’t import Python libraries in JavaScript.

https://psychopy.org/online/psychoJSCodingDebugging.html