data.importConditions doesn't work on Pavlovia

URL of experiment:

Description of the problem: Pavlovia

I used “data.importConditions” to read from my files in Psychopy, but when I try to run it online I get the error data not defined. I have seen some solutions where they add some JS code to the beginning of the experiment, but it doesn’t work for me as I use this in 3 different places, and I generate the name of the file randomly in that routine.

To go into more detail, this is the JS code I am referring to:

myData = new TrialHandler({

psychoJS: psychoJS,

nReps: 1, method: TrialHandler.Method.SEQUENTIAL,

extraInfo: expInfo, originPath: undefined,

trialList: ‘conditions.xlsx’,

seed: undefined, name: ‘myData’});

However, I have various trialLists and the names of the files are not ‘conditions.xlsx’

This is my code:

primeCond = randint(0, 2)
fileName = str(primeCond) + 'list.xlsx'
primeList=data.importConditions(fileName)

Thanks!

I think that the point of the JS code is that you should use it in full for each import, customising as necessary.

From my crib sheet:

Python

myData = data.TrialHandler(nReps=1, 
method='sequential', 
extraInfo=expInfo, 
originPath=-1, 
trialList=data.importConditions('conditions.xlsx'), 
seed=None, name='myData')

JavaScript

myData = new TrialHandler({
psychoJS: psychoJS,
nReps: 1, 
method: TrialHandler.Method.SEQUENTIAL,
extraInfo: expInfo, originPath: undefined,
trialList: 'conditions.xlsx',
seed: undefined, name: 'myData'});

Access individual values using: aValue = myData.trialList[Idx][‘variableName’]