Error while trying to load experiment in Pavlovia

Description of the problem:

I had a Psychopy experiment which was built on Psychopy 2. I converted it to Psychopy 3 and uploaded it to Pavlovia.org.

When I try to run it online, the initial screen where I enter the subject number appears just fine, but then I get the following error message:

"Unfortunately we encountered the following error:

  • when setting the image of ImageStim: image_4
  • when getting the value of resource: instr/m_recognition_complete.jpg
  • unknown resource

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

However, the image mentioned in the error exists in the folder titled instr, which I have in the experiment tree.

How can I resolve this?
Thank you,
Nira

Hi @nsaporta, does your experiment work well offline?

If so, check if your images have successfully been copied to your html/resources folder. Sometimes you need to manually copy them into that folder. When running studies online, that’s where stimuli and conditions files are read from (though you don’t need to change any file paths).

1 Like

Hi @sawal, I am facing a similar problem. My experiment runs fine offline. However, when I try to do a pilot run online (I don’t yet have a license/ credits, so I can’t recruit participants), I get the same error message. I couldn’t find an “html/resources” folder, and am not sure whether I can create one manually.

I’d greatly appreciate any advice you could give me.

Thanks!

Hello,

do you have locally a folder named html? If not, you can create the html-folder via file -> export html. You can set under “edit experiment settings” (the gearwheel symbol), online, export html to “on save”, “on sync” or to “manually”.

Cheers Jens

Hey everyone,
I am dealing with a similar problem (experiment works fine offline, but online immediately reads the same error).
I checked the html/resources folder and the files are there.
Do you have any idea why it can’t find it?

Another thing that might be relevant- after initializing the experiment (pilot/running) resources are being downloaded. Where to? Are they automatically deleted when the experiment is finished or the participants would have files left on the computers?

Thanks so much!

Hi everyone,

I’m confronted with this problem too: the experience works well offline, but online the same error message as nsaporta appears when sounds have to be played.

I checked the html / resources folder and the folder where all the sounds are is there.

Did anyone find a solution?

Thanks a lot!

Hi, Jens!!! Thank you very much for that advice. I changed the Export setting to “manually”, & then used the “Export html” option under the ‘File’ menu. I also ensured to sync the experiment again with the pavlovia online version.

Observations:- (i) There is still no “html” folder in my local experiment directory. All I can see is an “index.html” file now in the directory, that wasn’t there before.
(ii) When I try to pilot the experiment online, it still won’t run. :slightly_frowning_face:

Would you be able to give any further insight on this?

Cheers!

Chaitra. :slight_smile:

Hello,

well, if your experiment runs offline without error message and there is no error message when syncing the experiment, I have no clue how to help you. Without the html-folder and the files stored in this folder you will not be able to run the experiment online. The html-folder contains the resources and the javascripts files you need for an online experiment.

Cheers Jens

Hi !

I deleted my tasks and reprogrammed them starting over and I don’t know why but it works on my computer and even online!

But maybe you have already tried this technique…

Hi @cLEE, what version of psychopy are you using? Recent versions (I believe 2020.2.3 onward) no longer require/make an html folder as it added extra code that wasn’t necessary.

Do any of your resources load online, or do none? What type of file is it?
When you tried to manually add, which steps did you use? Try this (per @Becca): In your builder view go to ‘experiment settings’ (cog image)> online tab> + open and select the files your experiment will need then resync your experiment.

For other having issues and on a psychopy version that still creates html:

  • Make sure your path to the image is local (i.e. starts where your psyexp is stored, not at the root of your computer)
  • Make sure all of your slashes in the path are forward slashes-- psychopy can handle backslashes, but psychojs requires forward slashes
  • Make sure the file type (e.g. image1.png) is included wherever you call the files-- psychopy can figure out what the file is, but psychojs needs you to specify
  • Make sure the casing for all components (including the filetype) is the same in where you call the resource (i.e., in the conditions file or directly within Builder) and the files names themselves-- (e.g. image1.png, not image1.PNG)

Also, sometimes even if things are uploaded correctly to gitlab, it unfortunately doesn’t always show up in pavlovia. Try clearing your internet browser cache and re-synching.

Hope one of those solutions works for you!

Hi (@sawal), and thank you so much for the detailed suggestions. :slight_smile:

Firstly, you’re right, I’m using PsychoPy 3, Builder v. 2020.2.4, and it doesn’t generate a “resources/html” folder, but only an “index.html” file when the ‘Export html’ function is run.
Secondly, I’m not quite sure whether any of my resources loads online. After I hit the “pilot” button, a tab opens up with the message “initializing experiment”, followed by the “Unable to Load Resource” error message.
The error messages [all the times I’ve tried to pilot the task so far] have specified png image files, which are my task stimuli. However, the messages have referred to different image files at different times, identical to the problem described in this post: " 15h

Hello,

I’m getting the same error at the moment. Works fine in Psychopy. Have checked the image files and uploads all seem fine and are in /png format. They the same images have worked fine for me on another online Pavlovia experiment, so in my case not an issue with the files. For me the error changes with the resource specified changing (e.g. sometimes img 5 sometimes img 6 etc) suggesting some sort of general loading error? Very appreciative of any suggestions. Clearing cache and running using incognito don’t fix the issue. Is it possible to have too many or too large image files? Or too many nested loops?

code here: Sign in ¡ GitLab"

Fourth, yes, I’ve ensured that the path specified in my “Conditions” file is relative to the experiment, & not to the PC root directory.

Fifth, check. I’ve made sure to replace all backward slashes with forward slashes.

Sixth, check. I’ve ensured that image type is specified wherever an image is called up by the script.

Unfortunately, as in the post I’ve quoted above, the problem persists. I have even tried deleting the entire project, and uploading/syncing it from a different system altogether [just in case some weird glitch in my PC was behind the error]. But nothing works.

I have just shared the entire experiment folder with a colleague, asking her to sync it from her system [last-ditch effort].

Not sure what’s left to do… short of learning coding!

Again, thanks a bunch!!

The link does not load your project (error 404). Is it still private?

Cheers Jens

@ JensBoelte: Hi, there! :slight_smile: Thank you so much for following up! Yes, I have yet to procure a license, so the project remains ‘private’ for now. However, I would like to share that the problem I had originally posted was resolved, with the help of PsychoPy member t_pronk. :smiley: Since he responded to a message that I had left on a separate thread that someone else had posted, I was unable to attribute problem resolution to any suggestion/ advice left on my post. FYI, the error message was due to inconsistency in the case used for the image file-names (upper case) vs. the same file-names specified in the ‘Conditions’ Excel file (lower case).

Cheers!

  • cLEE.

Hi @cLEE, I saw that you were getting assistance on the same problem in another thread that looked like it was resolved, so I didn’t check in again here. Happy you were able to find a solution!

I’m editing my response above to include consistent casing of filetype for other folks trying to solve the same problem, so they can do easy checks through the checklist above and hopefully solve before putting in too much additional time.

Cheers!

@ sawal: Hi! :slight_smile: Yes, thank you so much for following up!

Cheers!

  • cLEE.

@ Clemencennl : Hi! :slight_smile: Thank you so much for taking the time to suggest this. The problem I described above has been resolved, thanks to the advice given by member t_pronk on another thread. It was an issue with mismatched cases used in specifying the image file-names in the script vs. ‘conditions’ Excel file.

Cheers!

  • cLEE.