psychopy.org | Reference | Downloads | Github

Trouble moving experiment to Pavlovia

URL of experiment: https://pavlovia.org/bbrashea/feature-verbalizablity

Description of the problem: This is my first time trying to export a PsychoPy experiment to Pavlovia. The experiment works fine from the PsychoPy console, but when I try to run it online, it is stuck on the initialization screen.

I know randomization is an issue when generating the JS files, so I wrote an admittedly clunky randomizer for the JS version:

ThisStim = Math.floor(Math.random() * 2);
if ((ThisStim === 0)) {
StimSet = “train/train_stimfile_VB_1.xlsx”;
} else if ((ThisStim === 1)) {
StimSet = “train/train_stimfile_NV_1.xlsx”;
} else if ((ThisStim === 2)) {
StimSet = “train/train_stimfile_VB_2.xlsx”;
} else if ((ThisStim === 3)) {
StimSet = “train/train_stimfile_NV_2.xlsx”;
} else if ((ThisStim === 4)) {
StimSet = “train/train_stimfile_VB_3.xlsx”;
} else if ((ThisStim === 5)) {
StimSet = “train/train_stimfile_NV_3.xlsx”;
} else if ((ThisStim === 6)) {
StimSet = “train/train_stimfile_VB_4.xlsx”;
} else if ((ThisStim === 7)) {
StimSet = “train/train_stimfile_NV_4.xlsx”;
} else if ((ThisStim === 8)) {
StimSet = “train/train_stimfile_VB_5.xlsx”;
} else if ((ThisStim === 9)) {
StimSet = “train/train_stimfile_NV_5.xlsx”;
}
}
StimSet = infile;
psychoJS.experiment.addData(“StimSet”, StimSet);

However, either this fix didn’t work or there is another issue with the JS file that’s preventing the experiment from running. I don’t have much experience working with JS, so I’m not really sure what other issues could be causing this.

The crib sheet might be a good place to start:

You can also see any errors produced by using debugger tools in the console (google “web developer tools” for your browser). That might give you better information about the errors + tracebacks to what line of code is producing them.

The first line of int_code in your int routine is an import which will cause a crash. Please look at my crib sheet for how to deal with randomisation.