Uncaught SyntaxError: missing ) after argument list

Hi everyone,

I am very new to PsychoPy and Pavlovia, and your help would be much appreciated.

I use PsychoPy v2020.1.2 under Mac OS 10.15.4.
My experiment runs perfectly on my local computer. However, I cannot run it as a pilot on Pavlovia via Chrome (v.83).
It was stuck on ‘‘initialising the experiment’’ message. The web console says that there is ‘‘Uncaught SyntaxError: missing ) after argument list’’ (js:2165):

This is the js of my experiment: https://run.pavlovia.org/andrewchang123/judgespeechmusic/html/judgeSpeechMusic.js

I do not know js at all. I checked line 2165, but I do not think there’s a missing ) …

I know that my question is very similar to this post: Java Script syntax error
But sorry that I am too new to this. So I do not know how to generalize that solution to my own case.

Thank you all!
Andrew

The line for the missing bracket error is where the computer realises that a bracket is missing rather than necessarily the line where it is missing.

Count the brackets in all of your code components. One way of doing this would be to copy them into Word and the search and replace as a quick way of counting accurately.

1 Like

Thank you @wakecarter for your reply. Yes, I counted. The numbers of ( and ) are equal. So that’s why I am very confused…

I couldn’t find an unbalanced bracket either but I did spot what looks like a formatted string

textPerc.setText(f'You have completed {str((((trials.thisN + 1) / 300) * 100)):.1f} % of this experiment');

I would expect this to give you a syntax error in the auto translate. Did you manually override it?

1 Like

Thanks!
It was indeed the problem. It seems that the translator cannot deal with something like “:.1f”