Task skips straight to last rep of loop

URL of experiment: Pavlovia

Description of the problem:
I have a very simple task with the structure below:

The outer loop should go through 8 repetitions (there a 8 rows to the condition file). It works fine locally when using the python code. When running online it only loops through once before coming to the end of the task.

Looking at the data file, it says that environmental_loop.thisN = 8, even though it only went through the loop once.

So it seems that it is skipping to the final iteration of the loop. This has never happened before (and I have a fair bit of experience with psychopy/pavlovia at this point).

Has anyone experienced this before? The task is currently set to only last 2 seconds per loop for ease of testing.

Thanks in advance,

You have to give access to your project. From your experiment page: view code> settings on left hand bar > permissions, set visibility to public, then share the URL of the project.

Best Jens

You yeah I forgot, sorry. It’s now public.

Hi Anthony,

I think the ‘.thisTrialN’ type variables may not always work equivalently online. Have you tried adding a manual trialcounter variable to count trials, and see if that functions as you expect?


Hi Becca,

Thanks for the thought, but no, that’s not the problem (I’ve just checked).

The incorrect behaviour isn’t related to any code refering to thisTrialN anyway. The issue is that it is only going through the loop once, and seems to think that the first time it is going through the loop is in fact the 8th time it’s going through the loop. The data file has only 1 row.

If it was actually the 8th time, then the behaviour is exactly as it should be. But it’s not.

Any other ideas?

Weirdly, it won’t save the loop counter variable I’ve added, even though it saves another variable which it’s coded to do so in the same place (and saves it correctly when running locally with the python script).

These two issues have me completely stumped, and I need to get them sorted so my MSc students can start collecting data!

Hi Anthony,

This was a funky one. After trying a few things, I switched ‘Use PsychoPy version’ from ‘latest’ to ‘2020.2.8’ in my experiment settings, and then pushed it online, and the issue doesn’t seem to occur any more https://gitlab.pavlovia.org/lpxrh6/partner_selection_v1 (note that I also added a ‘test’ routine before the loop as was trying something out.

Let us know if this fixes the issue for you too.


PS. this might mean there is a bug with using ‘latest’ in the use psychopy option, so thanks for flagging that - I’ll look into it

Hi Becca,

Thanks for looking at this. I’ve done as you suggested, but now when I try and run it, I’m getting the very helpful error message: Unspecified JavaScript error

This error message comes up before the participant number dialogue box.

Hi Anthony,

That is curious, are you able to fork my copy and see if that runs for you? this version doesn’t raise the javascript error on my end.


Hi Becca,

We’re brushing against the limits of my git knowledge here… can you talk me through how I’d do that?

Also, once I have done that, will it be possible for me to continue making changes in the builder and sync them?
Thanks again

Hi Anthony,

Yes sure!

Forking: Once you click on the link to a gitlab project( e.g. like the one in my post above) there is an icon that reads ‘Fork’ top right next to ‘clone’, click that and then select the ‘namespace’ you want to clone it to (your account icon). From there, return to your local psychopy builder and use the search icon to find the name of the task, you can then click ‘sync’ to pull yourself a copy to your local desktop. I recommend giving this a go with some other tasks too! once you have a copy you can edit it in builder however you wish.

Alternatively, I can make a merge request for you to pull the changes I made into your current project - would you prefer this? (note your original, pre-merge version will be in the version history)


PS. Note that I have also just added you as a member to my version so you might get a notification of that

I’m sorry - I seem to be failing at this. When I click Fork it just takes me to my own version rather giving me a namespace to select. Perhaps it would be best for you to put in the merge request? I assume I then follow the instructions re syncing again.

No worries - I am VERY new to this too, so this is useful for me to learn (thanks!) - I just submitted a merge request, please could you let me know if you receive that?

Yep, request received:

Should i click on Merge locally?

hmmm OK I see there are merge conflicts (meaning we have both edited part of the same part). Merge conflicts can be a bit of a nightmare, since the purpose at the moment is just to see if my version works for you, how about you download my gitlab project (use the cloud icon next to WEB IDE) and push it as a second project (in the long run you won’t want to keep both, but it will help figure out if this is working for you.


Okay, I downloaded it and resynced to Pavlovia

Unfortunately I’m still getting the unspecified error. I’ve opened the console with f12:

Clicking on the first error (core-2020.2.js:1822) gives me:

Clicking on the next gives me a massive chunk of code squeezed into one line.

ok I see - can I check - are you running 2020.2.8 locally?

When I first created it I was running 2020.2.4, but then I updated when I started running into problems. I think that was yesterday and have made successful changes since then, I think. But that was with ‘latest’ still selected in experimental settings.

ok, I was checking our set ups are the same to figure out how to create the error for myself (I am running 2020.2.8 locally), please could you add me to your project so that I can run directly from your experiment page. from gitlab page, click the cog on the left then select members, search lpxrh6 and please give me developer access.


Done. Sorry that this has turned into something complicated. I kind of expected it to be something simple about new loop definitions that I’d missed!

Thanks again for you help so far.