psychopy.org | Reference | Downloads | Github

Loading images to Pavlovia experiment via code component

URL of experiment: Sign in · GitLab

Description of the problem:

Hello there!
I have written an Attentional Blink Paradigm in PsychoPy Builder and it works perfectly locally, but trying to run it online throws the “unknown resource” error. I already tried different variations of the file path, but none worked.
The problem is, that I have 3 kinds of pictures I want to randomize independently from each other. I have the distractors that need to be randomized every trial and I have T1s and T2s that shall be randomized independently over 36 Trials in each block. The T2s I randomize in a loop via an .xlsx file, but including the T1 images in the same file resulted in the same T1-T2 pairs in each block. And I could not run a loop over two different .xlsx files. So I decided to load the T1 images and the distractor images via a code component and store them in an array that I randomize before each block/trial. I also copied the distractor and T1 images into the resources folder as they we’re not copied there automatically, but no matter if I change the path to “O_01.png” or “Stimuli\Neutral\T1\O_01.png” or “resources\Stimuli\Neutral\T1\O_01.png” or “html\resources\Stimuli\Neutral\T1\O_01.png”, I always get the “unknown resource” error.

Can someone help me there? I am actually kind of lost as I never worked with Pavlovia or html or JavaScript before… Just some local programming without any browser stuffunknown_resource

How many files download at the beginning of the experiment? Is that enough?

If images, etc., aren’t getting uploaded automatically, copy them to the local html/resources folder and they should get uploaded at the next sync. PsychoPy tries to copy necessary resources to this folder but is unable to detect resources specified in code components. Reading list index in sound component

Yes, it actually downloads 155 files when starting the experiment and I have 140 image files I use plus 15 image files I don’t use in the study any more but forgot to delete them from the folder before copying it. So I guess, all the images are downloaded…

In that case I think it’s a path issue.

Try Stimuli/Neutral/T1/O_01.png

Note that I’m using fore-slashes, not backslashes.

Uh thank you! That worked. Why did I not think about using the other slashes? -.-

But now I get this error:

grafik

Can I simply exclude the mask argument? Or does any image need some kind of mask even if it should not be masked?

I’d certainly try excluding the mask parameter.

jup, that fixed it. Thank you very much! :slight_smile: