psychopy.org | Reference | Downloads | Github

Variable file name in loop 'Conditions' field no longer working after update

Hi, I’ve been using a javascript chunk to generate a variable file name for each participant (as detailed here An approach to SONA integration and by-participant counterbalancing), and it used to work in previous versions of Psychopy/Pavlovia, but I have recently updated PsychoPy after a hiatus and it no longer works.
Briefly, I’ve included a ‘run at the beginning of the experiment’ javascript code chunk that generates file name and path (myItemList = 'trialOrders/ListNumber' +`${listNumberToRun}` + '.csv';), so that gives me a variable named “myItemList” that should have a value like trialOrders/ListNumber12.csv. I then enter $myItemList in the Conditions field for my main trials loop in Builder. This used to work perfectly in Pavlovia, but since updating PsychoPy Pavlovia no longer seems to find the file referenced by $myItemList: I get the following error message:

Error
Unfortunately we encountered the following error:
when importing condition: trialOrders/ListNumber12.csv
when getting the value of resource: trialOrders/ListNumber12.csv
unknown resource
Try to run the experiment again. If the error persists, contact the experiment designer.

I have verified that the experiment runs perfectly if I hard-code trialOrders/ListNumber12.csv as the entry in the Conditions field, but for some reason Pavlovia is no longer understanding (parsing? evaluating?) that the value of the variable $myItemList is the path that it should use as the name of the file.

What has changed in the way that the Builder evaluates variable names as entries in fields, and how can get this working again?

Thanks!

If you are looking to attach resources on the fly, then this post might help.

Alternatively, you can attach all resources via Experiment Settings / Online in Builder.

Okay, thanks for the hint; I’ve gotten it working now. So it seems that Pavlovia has changed the way it works with file dependencies, so is now either (a) no longer parsing code to determine which files it needs to transfer to users’ devices (whereas it might have previously done so), (b) only downloading some explicitly specified files as opposed to downloading the entire ‘resources’ folder (which no longer seems to exist), but either way it requires additional intervention to get it to download the necessary files to participants’ devices.

This one. Previously you had to manually copy files used in code to the resources folder.

The old method involved copying all of the resources to html/resources, which was an unnecessary waste of hard disk space. In the new version you specify these extra files instead.