Downloading and checking resources on the fly

URL of experiment: spelling [PsychoPy]

Description of the problem: I’m writing a spelling test where I want to download each word within the experiment.

Since I’m now using 2021.2.3, I need to use psychoJS._serverManager.prepareResources() instead of psychoJS.downloadResources();

The following code seems to be working in principle (for the conditions file).

psychoJS._serverManager.prepareResources([{name: conditionsFile,path: conditionsFile}]);

If I put


in each Frame I get:

  • TypeError: conditionsFile.exists is not a function

which I assumed had worked for @Mike_Pratte:

If I try my old code for checking resources:

try {
    continueRoutine = false;
} catch (e) {}

I don’t give an error but it doesn’t wait either, leading to:

  • Priya Tamber.xlsx is not available for use (yet), its current status is: "DOWNLOADING"
    unless I give the routine enough time for it to download.

I tried checking conditionsFile.status but it remains set to “undefined” which must mean I haven’t found the correct way to check it.

How should I be checking resource status?

Hi There,

I think your syntax is close - here is a demo I used recently which may help Rebecca / resource_load_demo · GitLab with the syntax used to prep the resources I think you m ay just need to add some code to the each frame tab to continuously check if the resource status

Hope this helps!

1 Like