Error when piloting online: when getting the value of resource

Hello,

I am trying to pilot my experiment online. In the first trial I get the error below. I have seen other posts with this error that said to change the format to .png, which my image is already in. Other suggestions say to put the image in the main folder and not in a subfolder, which it already is. Any other ideas?

The experiment is not made public yet, so it’s not accessible to other users. Also, you did not include the error.

My apologies, the image is there now. I had deleted the exp from pavlovia in hopes to reupload and fix it. However, I am now (again) unable to upload my experiment to pavlovia. Everytime I try to sync it I get the Forbidden 403 error message. I’m not sure what I am doing wrong.

Hello @bjackson55
I suspect you tried to re-upload the same experiment that was previously uploaded to Pavlovia. In my similar case what helped me solve the Forbidden 403 error was to remove the hidden ‘.git’ folder and ‘html’ folder before re-uploading.
Let me know if this helps,
cheers

Hello,
Every time I try to re-upload I remove the .git folder and html folder as well as create a whole new folder and rename the experiment, and am still having the exact same issue. I’ve done this more than 20 times at this point and still get the same message. I have even tried creating a new experiment in the builder and recreated the experiment, same issue. I’ve also tried on 2 different computers (one Mac one Windows).

Does it work to upload other experiments than this one?

Is there a js file in your local experiments directory?

Under „view code“, do you find all the files that are present in your local experiment folder?

Does the url when you click pilot point to the correct position of your index.html?

Did you try removing „html“ from your experiment settings („online“ tab)? I remember I had some issues with that until I let PsychoPy export everything into the main folder and no sub-directories.

It is happening for all of my experiments now.
The one I was trying to upload to Pavlovia will not even open with psychopy now. I just get this message:
Traceback (most recent call last):
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/app/builder/builder.py”, line 808, in fileExport
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/scripts/psyexpCompile.py”, line 71, in generateScript
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/scripts/psyexpCompile.py”, line 245, in compileScript
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/scripts/psyexpCompile.py”, line 217, in _makeTarget
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/experiment/_experiment.py”, line 286, in writeScript
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/experiment/components/settings/init.py”, line 834, in writeInitCodeJS
IsADirectoryError: [Errno 21] Is a directory: ‘/Users/brookejac55/Desktop/HuRein9/index.html’

When it was uploading to pavlovia and i went to view code all of the resources were there.

There is no js file, and I cannot create one because I cannot open the file anymore.
When I clicked pilot all that happened is it opened the Forbidden 403 page.

If i can get the program to open again I will try removing the html from the experiment settings. I have not tried that.

40 more tries of changing names and folders and it has successfully synced.
On trial 1 I get the same error message regarding the white.jpg (I changed from .png to .jpg as someone else said it may solve my problem but it hasn’t).
I can see that the white.jpg is there when I go to ‘view code’ so I’m not sure what the issue is?
My code is below. I have an image component with the $show_stim variable.

feedback_onset = 0
feedback_img_onset = 0
show_stim = 'white.jpg'
if corr_history[-1] == 1:
    score = score + 1
    response = "Correct +1 point. Total points: " + str(score)
    timeout = 1.5
else:
    score = score - 1
    response = "Incorrect -1 point. Total points: " + str(score)
    timeout = 4


I think this is what you are referring to for the online tab on the builder settings? Is this what it should look like?

This reads like there is a directory called index.html where PsychoPy expects a file called index.html. No idea, why this would prevent PsychoPy from starting, but to be sure you could look into that.

Concerning the picture: Did you declare the jpg as an additional resource in experiment settings - online?

Edit: Just saw in your screenshot that you have not. You should! Pavlovia will not know that your jpgs are part of the experiment if you don’t declare them there. This is because the pictures are only set as stimuli in code and not in a conditions file.

Hello @bjackson55

Can you please explain in detail what did you do to sync and export your project?

Also, definitely include your “white.jpg” in Additional Resources like suggested above.

So the issue definitely isn’t fixed, as I am still having syncing issues.
I pretty much just continuously creating new folders and and renaming the program each time, always deleting the index.html file, the .git files, and the .js file.
However, I actually did this 26 times before it worked successfully. I also removed more than half of my condition files. I had 18 and now have 6. I read that it may be a file size issue.
Then I tested my program and received the error message. I have made the changes to add the images to additional resources. And now I’m back to syncing errors. I have already moved and renamed everything another 14 times unsuccessfully.

Deleting the index.html only helps sometimes. I do this over and over and even after deleting that and the git files I seem to always have the same issue.
Thanks! I’ve made the change to the resources.
If I can ever get it to sync again :crossed_fingers: I’ll test it online to see if there are other issues

Could you post the experiment folder and tell me what version you are using? This random behavior sounds weird and I would like to see if I can replicate this.

The experiment folder is attached. I created the experiment in version 2022.1.2. I recently updated to the newest version of psychopy in hopes to solve the issue, but it did not seem to help. I’m really hoping this is an error I am making, that way I can figure it out and not have so much trouble in the future.
Thanks!
HuRein18.zip (248.3 KB)

I was not able to replicate your issue. I downloaded your zip, extracted it, deleted the js to see if I could export a “fresh” one (that worked fine), and synced it to a new project on pavlovia. Everything without problems. To see if there is any problem with changing the PsychoJS version, I also set this to the latest. This did also not produce problems. I made you a maintainer in the project I uploaded if you want to have a look and compare it.

Do you still experience problems when syncing? What exactly happens? Could you share some screenshots of the error messages?

Yesterday I had a lot of luck being able to sync my project. I was able to sync it when I sent it to you, find the ‘int’ error, fix that, and then resync to find a different error, try to fix it, resync…
I was able to resync 4 times successfully. Always deleting the .git folder and html folder in between. On the 5th try when I hit the sync button, I got the Forbidden 403 nginx problem. What happens, is I will hit the sync button, and then a new tab will open in my browser that is white background with black font Forbidden 403 nginx. And then when I go to pavlovia and go to my experiment and try to pilot, that page pops up. Then I tried to just delete the experiment from pavlovia again, create a new folder and rename my experiment files, delete the html and git folders and try again, same issue. Usually when I give up and wait to the next day I have more success even in the same folder that gave me an error message before. So I wonder if timing has anything to do with it?

So, the sync itself gives no errors, but when you try to start the experiment after syncing you get the 403 error, right?

I wonder what you mean by the “html” folder, since there was no such folder in the zip you posted.

When you are on a 403 page you could also open the console (ctrl + shift + K) and see if it gives you any error messages that are informative. Maybe take a screenshot and post this here.

I only know 403 errors from when I forget to compile a js script before creating a new project.

Do you shut down PsychoPy between your tries? Because I don’t think that timing is a factor here, but maybe what you do at the end of the day (e.g., shutting PsychoPy down or your PC).

After I synce there is always an html index folder that appears in my experiment folder. And I’ve read that deleting it in addition to the git folder can help solve the issue.
I do shut down psychopy between tries when I start having issues, it doesn’t seem to make a difference really. I will close out, create a new folder, and then often get the same issues.

When I tried to sync just now, for the first time today, I received this message:
Traceback (most recent call last):
File “C:\Program Files\PsychoPy\lib\site-packages\gitlab\exceptions.py”, line 304, in wrapped_f
return f(*args, **kwargs)
File “C:\Program Files\PsychoPy\lib\site-packages\gitlab\mixins.py”, line 112, in get
server_data = self.gitlab.http_get(path, **kwargs)
File “C:\Program Files\PsychoPy\lib\site-packages\gitlab\client.py”, line 662, in http_get
result = self.http_request(
File “C:\Program Files\PsychoPy\lib\site-packages\gitlab\client.py”, line 628, in http_request
raise gitlab.exceptions.GitlabHttpError(
gitlab.exceptions.GitlabHttpError: 404: 404 Project Not Found

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\projects\pavlovia.py”, line 663, in project
self._project = self.session.gitlab.projects.get(self.id)
File “C:\Program Files\PsychoPy\lib\site-packages\gitlab\v4\objects\projects.py”, line 782, in get
return cast(Project, super().get(id=id, lazy=lazy, **kwargs))
File “C:\Program Files\PsychoPy\lib\site-packages\gitlab\exceptions.py”, line 306, in wrapped_f
raise error(e.error_message, e.response_code, e.response_body) from e
gitlab.exceptions.GitlabGetError: 404: 404 Project Not Found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\builder\builder.py”, line 1380, in onPavloviaRun
pavlovia_ui.syncProject(parent=self, project=self.project)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\pavlovia_ui\project.py”, line 743, in syncProject
if not project.localRoot or not Path(project.localRoot).is_dir():
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\projects\pavlovia.py”, line 746, in localRoot
if self.project.path_with_namespace in knownProjects:
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\projects\pavlovia.py”, line 666, in project
raise KeyError(f"Could not find GitLab project with id {self.id}.")
KeyError: ‘Could not find GitLab project with id 248590.’

So I just created a new folder, and now received the 403 below. When I hit ‘ctr + shift + K’ another Forbidden 403 window appears, nothing else.

This is Chrome, right? So it might be ctrl + shift + J.

The index.html folder seems to be a bug. Such a folder should not appear.

Do you delete all your old tries on pavlovia?

This is my latest attempt, now moving everything over to my Macbook.
I do get the index.html folder, screenshot below of the folder and then what it contains. This time when trying to sync, I got the Forbidden 403 and also a message saying there is no js file, even though there is? The last image is I think what you were looking for, let me know if it’s not.





Edit
Immediately after the try and errors above, I renamed the folder, the psyexp, .py, and js files again and it synced. Which is exactly what I did before. Here’s to hoping I receive no errors in this piloting attempt so I don’t have to sync 30 more times!

Edit Edit
Nevermind it also gave me the Forbidden 403 error.