Does the fact that i can not find a variable named os on the java script mean, the problem comes from the os import on the python script? Should I find a replacement of that?
I think I found the lines where the problem is in the javascript:
var _pj_a = , _pj_b = os.listdir(img_dir);
_pj_a.push(os.path.join(img_dir, i));
It does not recognise what the os is here. This is because there is no ‘import os’ or something similar at the beginning of my JS just as there is an import os at the beginning of the python script.
Is there an os for JS which I have to put at the beginning of the script and if yes what is the exact structure?
Or I need to change the commants of listdir and path.join?
Did you add this code? It looks like it is supposed to create the image list by looking at the folder. This won’t work online. The easiest option is to use a spreadsheet.
Yes i added this code because the selection of the images i want is quite complicated. So from a subset of 11 image files I want the programme to randomly select 3 different ones for each participant. These three will be the targets and the rest will be the distractors in the visual search task. But for every participant, three different targets need to be chosen.
How can I do this using a spreadsheet? or a code part that will work online?
Based on my understanding of your design you probably want to load all of your items as fillers and then slice it into one list of targets and one of fillers. Alternatively, you could simply append the first 3 items to the targets list and then the following 8 to fillers (based on a loopIdx counter)