Description of the problem:
Hi, hope all is well and someone can help. Me and a colleague have an experiment which runs fine locally via psychopy and successfully uploaded the experiment files (except the below mentioned) including html to Pavlovia with no errors reported in the runner/scripts. However, the experiment is stuck on ‘initialising the experiment’ when ran online. Can someone help please?
The experiment has a lot of png images (around 1250 all relatively small sizes around 4kb). Some of these have been organised in subfolders i.e. separate image category folder → 50 subfolders → 20 images within each. Could it be that this is too many images or that the subfolder arrangement is causing issues perhaps as the images are not typically all in one folder? Or could it be this is just too many images/files? I noticed that when exporting the experiment to html, one of the folders containing 80 images and another folder with 58 subfolders (20 images within each) did not export so I had to copy them across manually.
We have an excel file that has 5040 possible random combinations of these files also in the experiment so that psychopy presents one of these combinations and lets me know which was shown and if their responses to the 7 random images are correct. Perhaps this may be an issue? If there is a more efficient way to do this also then please do let me know?
Hi Thomas, thank you. One did pop up. Any ideas? do i need to rename variable perhaps?
the error in network panel was ‘ncaught SyntaxError: Identifier ‘xys’ has already been declared’ ’ line 1280 which would be for the line of code with ’ const xys = ClickNo.getPos(); '. The section of code this belongs to is '// store data for thisExp (ExperimentHandler)
const xys = ClickYes.getPos();
const buttons = ClickYes.getPressed();
psychoJS.experiment.addData(‘ClickYes.x’, xys[0]);
psychoJS.experiment.addData(‘ClickYes.y’, xys[1]);
psychoJS.experiment.addData(‘ClickYes.leftButton’, buttons[0]);
psychoJS.experiment.addData(‘ClickYes.midButton’, buttons[1]);
psychoJS.experiment.addData(‘ClickYes.rightButton’, buttons[2]);
if (ClickYes.clicked_name.length > 0) {
psychoJS.experiment.addData(‘ClickYes.clicked_name’, ClickYes.clicked_name[0]);}
// store data for thisExp (ExperimentHandler)
const xys = ClickNo.getPos();
const buttons = ClickNo.getPressed();
psychoJS.experiment.addData(‘ClickNo.x’, xys[0]);
psychoJS.experiment.addData(‘ClickNo.y’, xys[1]);
psychoJS.experiment.addData(‘ClickNo.leftButton’, buttons[0]);
psychoJS.experiment.addData(‘ClickNo.midButton’, buttons[1]);
psychoJS.experiment.addData(‘ClickNo.rightButton’, buttons[2]);
if (ClickNo.clicked_name.length > 0) {
psychoJS.experiment.addData(‘ClickNo.clicked_name’, ClickNo.clicked_name[0]);}
// the Routine “Consent” was not non-slip safe, so reset the non-slip timer
routineTimer.reset(); ’
Replace the first const xys by let xys and remove the second const before const xys.
Explanation:
const and let declare variables. You can only do this once, after that you can just assign values to the variable without needing to declare it again.
const means ‘constant; I’ll assign a value, but after that the value may not change’. Based on your code I guess you do want it to change, so use let or var instead.
Unfortunately this didn’t work but I couldn’t have done with it without your help and thoughts. I found the fix by renaming the variables ‘xys’ so i renamed the first ‘xys’ as ‘xys1’ for ‘’‘const xys’’’ and i renamed the second ‘const xys’ one as ‘xys 2’. I then got the same error for the ‘button’ in the same section of the script but did the same thing. It seems it was to do with mouse clicking in two areas/boxes for my yes and no option.