Online experiment crashes - can't find my trials variable?

URL of experiment: Pavlovia

Description of the problem: My experiment gets stuck before my loop begins, and I get the following error:

it seems like the plaform is being unable to find the trial variable of my loop?. This has never happened to me before, I’m really stuck.

Did you change the code since posting it here?
I receive a different error, so I want to make sure we are on the same page:


Thank you very much for checking.

Actually no, I haven’t changed the code. I tried to run it right now and I keep getting the same error I described above:

I don’t think I’ve encountered the error you are showing yet, ugh :frowning:

If I understand correctly, the experiment works fine online, but the problem shows only offline, right?

Looking at your Javascript code, you are using list() the same way as in Python. For example:

if ((! (population instanceof list))) {
    population = list(population);

But list is not a javascript object/method. I can see the usage of the list 23 times in your code, so you need to fix it to make it work online.

About the error you received, I am not sure what is causing it.
Did you try updating PsychoPy to the newest version? Because it works on my machine (v2022.2.5)


It’s actually quite the opposite: it works perfectly offline but breaks online. I have the latest version of Psychopy (v2023.1.1).

I do use a lot of code componente involving lists. I thought the conversion to JS was done automatically in the builder.

It’s odd that you’re getting a different error than me. I will check how lists work in JS and get to it, but sadly I believe this doesn’t solve my issue with the trials :frowning:

I meant the opposite. It works fine offline and doesn’t work online :sweat_smile:
Maybe someone else has more experience with it and can give a different perspective. I’m not sure why you are getting this error…

Do you have concentric loops?

If so, go to Experiment Settings and try changing the use version to 2022.2.5


As @wakecarter suggested, I changed from v2023 to v2022.2.5. When I did that, I started getting the lists error @Chen mentioned.

I solved that by reading how to properly manage lists in JavaScript (chat gpt <3 ) and now my experiment is running smoothly :smiley_cat:

Thank you very much @Chen and @wakecarter!!!

1 Like