Using expInfo for counterbalancing to call upon different files

PsychoPy v2020.2.8, running on MacOS big sur v11.1. Pavlovia run from Google Chrome v87.0.4280.141 (x86_64)

Hello all,
I am continuing to set up my experiment on builder and syncing it every now and then to pavlovia to make sure that it pilots on there as well. I’ve run into a problem that is leaving me rather dumbfounded.

My setup is as such. I have first an instruction routine where a jpg of the instructions is presented (semanticGo), then an experimental routine that loops over a csv (semanticExp). There are 2 versions of each (v1.jpg, v2.jpg, and v1.csv, v2.csv). Odd numbered participants should get the first one, even numbered should get the other. Sounds simple enough, right?

My first solution (didn’t work):
I added a field to expInfo “SEMVERS” with the default value “v1”. For odd participants I will manually enter v1 and for even numbered participants v2. I call upon this information for the instruction routine, then again in the Conditions field for the exp routine.

Locally, it works great. As soon as I put it online I get the error:

This is frustrating because I have done the exact same thing earlier on in the experiment (calling upon an expInfo condition in the ‘conditions field’) and it works great both online and locally. I’ve tripled checked that the files have been synced properly, that the cache has been cleared before running the experiment, and that a copy of the materials are in the path html/resources.

Second attempted solution (didn’t work):
I removed the newly added expInfo field mentioned above and instead added a code component in the “begin routine” part of the instructions routine, written in JS. I then call upon this item in my imageStim “$semGroup”. Now, the experiment doesn’t even run locally, and much less online! (It works locally with the same code in python by the way, just not with javascript). I tried changing the Image field from constant to set every repeat and that doesn’t change anything either.

The error:
NameError: name 'semGroup' is not defined

I am truly so frustrated because I feel that this should be so simple yet I am struggling so much. Does anyone have any ideas?? I’d appreciate it so much.

When you add resources in code you need to tell PsychoPy about them in Online tab of Experiment Settings or download them on the fly. I’d recommend downloading both v1.jpg and v2.jpg in addition to both Excel files.

You should put semGroup="" above the if statement to get rid of the not defined error.

Hi @wakecarter thanks for your quick reply.

I’ve added the code you suggested, but I’m still getting the NameError.

I didn’t know about the Online tab of Experiment Settings, I’ve added the resources there as well. I’m not sure if I have to fill out the rest of the fields

What do you mean in your comment about " downloading resources on the fly" ?

Sorry, I meant put it in a Begin Experiment tab.

On the fly means after the experiment has started.

@wakecarter even with

semGroup = "";

in the Begin Experiment tab, I still get the NameError

I’m not sure if there’s a third alternative way to do what I’m trying to do? Do you have any suggestions?

I’ve just noticed that you are writing in JS only code components .

As per my crib sheet I strongly recommend coding in Python in Auto translate code components. This will help check your syntax.

expInto[‘participant’] will be text so I use int(expInfo[‘participant’])