"loopname.finished = true;" started to work in online experiments?

Hi all,

I’ve long known that in order to end a loop in PsychoJS, you need:

trials.finished = true;

whatever the loop name is. And this had been working well on me.

With my most recent paradigm, however, I had trouble ending one of my loops with the command above, while it works fine with another loop.
I spent hours troubleshooting, and I end up desperately replacing “trials” with the real loop name, without having any hope that it would work. But it worked…!!! :joy:

So in short, here is what I have when trying to end two different loops:

Loop1 name: trials_2
trials.finished = true; ---- This works
trials_2.finished = true; ---- This also works

Loop2 name: trials_3
trials.finished = true; ---- This doesn’t work
trials_3.finished = true; ---- This works!

I’m running PsychoPy 2020.2.4 on a Win64 machine.

Well. The mystery was resolved, but there seems to be a bigger mystery…
If anyone has any comments, please feel free!


Hi @tlan, I initially had trouble with this too following older Discourse solutions to problems that used trials.finished in js, but no longer work on v2020.2+

It’s documented in the 2020.2 changelog so that psychojs is more consistent with py in this regard, which is a good change in my book! Happy you were able to figure it out in the end.

Thank you for your comment. I must have missed that important info in the changelog…

1 Like