'uknown resource' when trying to load image - online experiment

URL of experiment: Pavlovia

Description of the problem: Image won’t load in on-line experiment.

I have put an experiment online that features a specific problem - but works fine locally.

I am trying to use an image file (a .png with transparent background) of a triangle to point out the correct button participants should have clicked after a practice trial. (yes I tried using the polygon object but this also failed online with an error about ‘triangle’ not being accepted in the vertices argument - gave up).

The specific image file I have uploaded as the pointer consistently throws an error:

" Unfortunately we encountered the following error:

  • when setting the image of ImageStim: TriPointer
  • when getting the value of resource: resources/triangle3.png
  • unknown resource

Try to run the experiment again. If the error persists, contact the experiment designer."

Now I have tried replacing, regenerating, renaming this pointer image in every way I can think of - to no avail. Bafflingly - if I use the code to point to a different image file (the ‘continue’ button) I have in the same ‘resources’ folder - it works fine. I have also checked that the image file is successfully uploaded into my online ‘resources’ folder. So there would appear to be a problem with this image file??? Or something??? Although when I rename the ‘continue button’ image to the triangle name image - ALSO throws the problem. (have also tried using different filenames etc…)

I am stumped.

At the moment the experiment is set to demonstrate the problem. There are two practice trials. After the first practice trial - in the ‘Feedback’ routine - the code displays the ‘continue button’ image (where the triangle should be) and this works fine. On the next loop of the trial - the image loaded should be the ‘triangle3.png’ file - and psychopy will throw an error.

Could anyone have a look and see if they can see what I am doing wrong here? I have spent a day on this and am beyond exasperated.

Thanks everyone.

The code that generates these two images (in the ‘Feedback’ routine) is as follows:

if colourcongruent == 1:
    # point to right button
    TriPointer = visual.ImageStim(
    win=win,
    name='TriPointer', 
    image='resources/continue_button.png', mask=None,
    ori=90, pos=(.25, -.28), size=(0.17, 0.17),
    color=[1,1,1], colorSpace='rgb', opacity=None,
    flipHoriz=False, flipVert=False,
    texRes=128.0, interpolate=True, depth=-4.0)
    TriPointer.setAutoDraw(True)

else:
    TriPointer = visual.ImageStim(
    win=win,
    name='TriPointer', 
    image='resources/triangle3.png', mask=None,
    ori=-90, pos=(-.25, -.28), size=(0.17, 0.17),
    color=[1,1,1], colorSpace='rgb', opacity=None,
    flipHoriz=False, flipVert=False,
    texRes=128.0, interpolate=True, depth=-4.0)
    TriPointer.setAutoDraw(True)

Again, note that the first one works, the second one doesn’t.

I should note I am using Psychopy 2021.2.3 locally because my little laptop’s OS is now to old to run the new version. :frowning:

Thanks everyone.

D.

Use experiment settings (cog image in Builder) > online > +/- keys to add the list of resources your experiment will need.

PsychoPy should automatically detect and add resources which are hard coded (explicitly named) in your image/video/sound/form components and loops but will not know about resources which are set via variables.

Taken from PsychoPy Python to Javascript crib sheet 2021 - Google Docs

1 Like