psychopy.org | Reference | Downloads | Github

Cannot find online resource

URL of experiment: Sign in · GitLab

Description of the problem: Failure to find resource during initialisation

I am trying to debug an online experiment locally but no matter how I structure my folder the JS file cannot find the relevant resources. My directory structure in PsychoPy is the following:

The folders in stims I have to copy manually to the resources folder since they are loaded by code components, but the info folder gets copied to resources automatically. Yet when I run the debug it fails to find it since it is looking for them in info/image instead of resources/info/image.

Screenshot from 2020-11-05 13-08-25

I tried modifying the directory structure but it still fails and even changing the code in the JS (to look for the images in resources/info/image fails with the same error message but with the new path.

It’s also odd that I need to copy the images/files again into the html folder for no reason. Can’t the JS version just look for things in the same place as the Python version?

Any ideas on how to solve this?

Thanks,

Milton

EDIT 1: The code I am working on is the pilot branch of the project. I have resisted merging on to master until it actually works.

Upper and lower case in the filenames?

Cheers Jens

Sorry, I don’t understand what you mean. Everything is in lower case, should that make a difference?

Hi There,

I have had a go forking your tasks and ran into a few different issues before encountering the initial issue you outline here.

Before I go much further with debugging, please can I check something. Currently you are trying to import some python libraries in the first routine of your experiment:

import * as xlrd from 'xlrd';
import {RandomState} from 'numpy/random';
import {imread} from 'matplotlib/pyplot';

These are contained on the JS side of your code component, but there is no folder corresponding to numpy or matplotlib (so there won’t be anything to import at the moment). Furthermore, to my knowledge these are not importable in JS - had you found a manual alternative you were trying to implement here and perhaps I am missing the folder in my forked copy?

Thanks,
Becca

PS. as a side note, can I recommend that it is FAR easier to debug by enabling export html on sync (as opposed to the manual setting currently implemented) and making any changes to your builder file, rather than trying to change the .js file directly. Any changes you make in your .js file will not be reflected back in your builder file, which will can make it difficult to use and adapt the task in future as your builder file essentially becomes useless.

Oh, my bad. I should have mentioned that the code I am currently working on is in the pilot branch. I can either merge with master or you can fork that one. You will probably need to recompile the HTML. (I’ll update the initial post).

That code has the Python imports removed, but there is a fair bit of code missing (i.e. loading the stimuli and record the responses properly) so it will fail. However, I cant debug that part if I can even get past the part I am stuck in, which does not depend on those.

I also tried putting everything on resources/, hoping that it would be copied as it is into the html, but what happens is that it gets put in resources/resources which defeats the purpose.

I think I have found where the issue might be. When I pilot it online it finds the folder with the resources just fine, the issue is locally. It’s not a deal breaker. but having to upload and run a pilot just to debug is very annoying.

I found someone mentioning this error, but their fix didn’t work for me (delete de HTML folder and recompile). If you have any insight into this, it will be much appreciated.

Thanks,

MIlton

Hi Milton,

Blockquote Sorry, I don’t understand what you mean. Everything is in lower case, should that make a difference?

sorry, my response was to implicit. I meant that the filenames of you resources are (partially) written in a different case (upper/lower) than in your reference “list”. This does not matter on offline, at least not on a Win-system, but online. But apparently that is not the case.

Cheers Jens

1 Like

Hi Milton,

Can I please confirm if you are still encountering issues. If so please can you add me to your repository so that I can see the code you are working from? my username is lpxrh6.

Thanks,
becca

Hi @Becca ,

Yes, I still am. I’ll add you to the repo. Just a couple of things worth noting.

To test the difference between the code running online and offline I created a new test repo that only has the routine that is currently failing. It doesn’t give me an error online, but it does raise it when running the local debug (it can’t find the resource). I believe there is a mismatch between the way the code should be loaded by the lib (maybe?, my knowledge of JS is almost 0).

You mentioned syncing your project with Pavlovia, but I can’t manage to connect through Psychopy. It always gives me the same error TLS/SSL support not available; install glib-networking. I can confirm that glib-networking is installed. I found this issue, but their fix (install Psychopy from pip instead of conda) also didn’t work for me. I thought updating the Pavlovia code/html folder would work by just pushing to the repo but it isn’t. I enabled a previously disabled component to test this and it did not update. Maybe cleaning the browser’s cache is enough, but maybe this is also creating problems for me when I change code locally and want to test it online.

I apologise for the long reply as I am trying to retrace all the things I have tried. I believe there is something missing in the way I’ve set up my Psychopy installation but I do not know what it is.

In any case, I appreciate the help. I’ll add you to the repo now.

Thanks,

Milton

PS: Just make it clear, I am running Ubuntu 20.04 and I installed Psychopy using conda and the environment file in the installation guide.