Resources don't load and I can't find the solution elsewhere

URL of experiment:

Description of the problem:

Hello everybody, I’m new with psychopy and pavlovia. I built a task that works fine in the builder, but not online. I used psychopy 2.8 version. In the task I present several music excerpts and pictures. All the stimuli are used for every participants, but in different orders, so my path is dynamic, because there is randomization of conditions. In other words, my song and picture name is a variable containing the path (that changes everytime). When I push the experiment online, there is no html folder created, nor a resources folder. I’m not sure if this can be a problem, but in doubt I created manually a folder called “resources” that contains all of my files. When I try to run my study online, I get this error:
error

I looked to many different threads about this but I haven’t understood what my actual problem is. The name of the file is correct. For what I understood, the program doesn’t know that I have resources in my experiment and doesn’t load them at the beginning. It could be that I write a wrong path, but I haven’t found information about how to define the path in pavlovia (I tried different thing anyway, URL, point, no point, slash, no slash, but nothing works). I see that I can also load the resources manually, but as I have a dynamic path I’m not sure how to do this without having to change many parts of the code. Do you have any idea of what causes the problem and how to fix this?

Thank you very much,

Francesca

Hello Francesca

does the program run off-line? There is no *psyexp in your repository. Do you have a loop for your routine that loads the material? You can add on-line resources via the edit experiment setting menu → on-line → additional resources. Otherwise Pavlovia does not know where to look for your resources.

Best wishes Jens

1 Like

Hi Francesca,

I ran into what I think is a very similar issue. I couldn’t figure out why one experiment could load its resources and another could not. I came up with an inelegant but functional work around:

psychoJS.start({
  expName: expName,
  expInfo: expInfo,
  resources: [
     {'name': 'CND.xlsx', 'path': 'resources/CND.xlsx'},
     {'name': 'CBL.bmp',  'path': 'resources/CBL.bmp'},
     {'name': 'CBP.bmp',  'path': 'resources/CBP.bmp'}, 
     {'name': 'CBR.bmp',  'path': 'resources/CBR.bmp'}
  ]
});

If you go into your .js script file, towards the top you’ll find the psychoJS.start command. You can put in a resources field and then load in whatever you want to put in there.

I’m sure there’s a better way, but this worked for me.

For the dynamic path issue, note that the ‘name:’ field will be how the resource is identified later in the script. So, going off the example code I put up here, if you wanted to dynamically choose a stimulus, and you have a process to spit out the first, second and third letter parts of stimulus name, then you can simply + them together to concatenate:

curStimName = firstLet + secondLet + thirdLet +".bmp"; 

Not sure if this applies to your situation, but hope that helps.
-Adam

1 Like

If you go to experiment settings and the “online” tab, you can add resources with the GUI

1 Like

Dear Jens,
thank you so much for your reply! The problem was indeed that the resources didn’t load, I added them as you suggested and now it works. I’ve read that solution before but I wasn’t able to understand where I had to change the settings.
Thanks again!

Best wishes,
Francesca

Dear all,
I could solve the problem by adding the resources from the builder in the settings, thanks to everybody that helped me!

Best wishes,

Francesca