psychopy.org | Reference | Downloads | Github

Pavlovia – Stuck on Initialising Experiment and Odd Unexpected Token

Hi all,

I’ve seen a few related posts on here but I can’t seem to make any solutions work on my end. I am very new to PsychoPy, Python, and online experiments in general so I am sorry if this issue is apparent and I am just missing something. The experiment runs just fine without error in PsychoPy, it just won’t move online for me…

URL of experiment: Pavlovia
Project page: Sign in · GitLab

Here are my errors:
ERROR line 3559: Unexpected Token: in FinalHebbParadigm.js.
ERROR line 3557: Unexpected Token: in FinalHebbParadigm-legacy-browers.js.

Sounds like an unmatched bracket. Please could you post the lines mentioned in the errors

1 Like

Of course. I think this is what you mean but this is the code converted into py and I think the error is in js… I couldn’t see any errors here so I’m a bit confused (again, very new to all of this).

Please could you look for the lines in the js files which are in the html folder on Pavlovia?

Of course. I seem to have fixed the above errors, but have encountered some new ones…

84.7323 ERROR Line 3545: Unexpected token : in FinalHebbParadigm.js
87.4455 ERROR Line 3543: Unexpected token : in FinalHebbParadigm-legacy-browsers.js

Here are the lines of code for both errors in js (sorry):
3545 in js: text.setText(Sound10Filler[:(- 4)]);
3543 in legacy: text.setText(Sound10Filler[:(- 4)]);

Thanks so much for your willingness to help me!

This is the way I have it set up in my experiment…maybe I need to add another bracket to complete the code?

This translates to JavaScript as Sound10Filler.slice(0, (- 4));
which means you’ll need to set it in a code component and use a variable instead of Python code in the text component.

1 Like

Thank you so much! It worked and I encountered other errors similar to this along the way and was able to fix them because of your help. Thanks again!