Stuck on initializing experiment: uncaught syntax error

URL of experiment: sm_partial_info_different-gender [PsychoPy]

Description of the problem:
I am trying to pilot my experiment on Pavlovia to make sure it runs correctly before running it with participants. The experiment is getting stuck on the initializing experiment stage. After inspecting it with the developer tools (F12 key), it is saying there is an uncaught syntax error: strict mode code may not include a with statement.

I’m assuming there is a python–>js transcribing problem. I was wondering if anyone has any advice on how to figure out what the problem is and/or how to fix it?

The offending code is

    // update component parameters for each repeat
    with open('sm_partial_info_stimuli-words.txt') as f:
    with open('sm_partial_info_stimuli_different-gender-images.txt') as f:

Why aren’t you using an Excel or CSV file and loop or trial handler?

Are you trying to read the contents of a file into a list? If so, I use a loop and append – see my Interleaved Lists code snippets.

Thanks for getting back so fast! I was told to try using a text file and the with open function by a grad student in my lab to avoid having to use the random function that doesn’t auto-translate to js. So would the easiest method to fix this just be to read everything from a csv file instead and then it should hopefully run fine?

The random function is easy to get working online so I think the grad student has sent you in the wrong direction. I haven’t seen anyone use the open function online.

So yes, try with a loop or shuffling a list