Specifying a response from a conditions file and saving responses

I would rather like to focus on getting the responses saved in the output. Can you tell me if the keyboard component is set up correctly? What about the lines of code that I thought about adding?
Thank you and have a good weekend!

In that case I’m not going to be able to help you much further, I’m afraid.

I note that in your code you are saving the keys pressed to the data file but not the score.

Thank you, I’ve had a look into this, but the issue is that the keys pressed aren’t saved either. In fact, no responses at all are being saved. Is there any further advice about what I can do to get any response data saved?

Hi Jasmine,

I really would recommend trying to fix the sync issue first as Wake suggests. Storing correct answers and giving feedback is very simple in PsychoPy builder, with minimal need for code. It will probably take much less time to fix the sync issue and then check why accuracy isn’t storing than to try and hack the Javascript code (which also might be difficult for future lab members to work with).

Can you tell us more about the sync issue - what seems to be happening there?


1 Like

Hi Becca, thanks for looking into this as well! I have followed your recommendation and created a new experiment that I will now try to debug from the offline PsychoPy.
The issue that I usually have with this is that when synchronising changes PsychoPy doesn’t seem to recognise that the experiment already exists online and I have to create a new one with the same name. That can be quite confusing and time-consuming. Further I find that fixing certain errors can be done a lot faster in the online Js, rather than through the builder. For example, now I am receiving an unknown image resource error, even though the png file is located in the html/resources folder and this path is also specified in the builder component.

Please recreate your experiment again with nothing in the Online Output Path. The html folder doesn’t work with the latest version of PsychoPy

Also, make sure you aren’t saving your local files on a cloud drive.

Hello Wakecarter, thank you so much for the patient and quick support with this! I have tried to recreate the project, but it is indeed somehow always drawing the resources from a previous project and I have not found a way to delete the repository from github. I have therefore created a whole new pavlovia account and created this as the first and only project there. However, somehow it is still linking the resources with my previous github account. I am really confused and don’t understand why this is happening.

The issue is with local git files and hidden folders which is why I often recommend moving the psyexp file and resources to a clean local folder. Then reopen in PsychoPy and sync.

Just to follow up here - if possible try to show hidden files and delete the .git (it can be annoying in the long run to have lot’s of hidden .gits lying around)

Update: I have attempted to add the code lines
expName: expName,
expInfo: expInfo,
resources: […

into the ‘before experiment’ ta, and removed the other psychoJS.start lines. Now the experiment is stuck in initialising with the error “Uncaught ReferenceError: Cannot access ‘psychoJS’ before initialization”

Hi Jasmine,

Yes I would advise not to try adding that code snippet to inside you experiment, that will try to launch your experiment twice and it will cause complication. Is your experiment pushing and syncing to pavlovia ok now?


Hi Becca, unfortunately I’m still getting error messages when trying to sync and I have to delete the experiment from my dashboard each time and then upload it anew. But then the resources are uploaded in a very strange folder structure and I have to upload each resource individually into the correct folder to solve the resource error… but then I am receiving more errors…
It has really been easier to directly change the .js code in the html folder and I already got a lot further in this way. Is there really no way you could help me to get the responses to save by debugging the code?

Hi Jasmine,

Please can you share the error messages that you get when trying to sync? Then we can offer support to try and fix that problem.

Sorry, but I am less familiar with pure JavaScript code and we really do advise against directly editing it unless you are confident with JavaScript syntax. it really is better that we fix the root cause of the issue by trying to figure out your sync error.


The first error I usually encounter when trying to sync. By deleting and uploading again, I can get it to upload, but when trying to pilot, I receive the 403 error.
When then deleting and uploading again I can get the piloting to ‘start’, but then encounter the undefined name error.

Before when working on the code I was able to run the entire experiment, with pretty much the only issue of not having the responses save.

OK a “timeout error” means that connection to the server was lost during the sync. Usually this will not occur every time - for me clicking “ok” and retrying is enough. How big is the project/contents of your working directory that you are trying to sync? are there a large number of files?


That’s correct, when clicking ok and trying to sync again it works, but then I receive the 403 error upon piloting.
At the moment there are 16 resources. After having changed the folder structure manually I have not had any further resource errors.
I have made some progress in solving one error after the next, for example I now have to adjust the units of the builder components, which will take me some time.
I really appreciate your kind support! I will try to work myself through the remaining errors. Once I get the experiment to run I will check what is happening in the response output and get back to you. :slight_smile:

The 403 error occurs when there is no index.html file in the location you are using to launch your study.

Just to expand on this a little, if there is an error that has prevented the index.html from being written (please do confirm if wakes inkling is correct and there is no index.html file) - the error will usually appear in the Runner view in the section labeled “StdOut” - does anything appear there?

Hi Becca, Thank you so much for all the support and advice! Over the last couple of days I managed to solve all the remaining errors and now everything works smoothly, including the saving of responses. So in the end it seems that not syncing from builder caused the problem of not responses not saving online. I noticed that another cause of some functions not working properly online was if the respective code snippet was not located at the top of the builder panel.
With respect to the 403 error, I checked the html folder and the index file was there, both in the offline and the online folder on gitlab. There was also nothing specific in the StdOut section, relating to the index file. I have the impression that the error occurs partly as a time-out, or possibly when there is a problem with over-writing the existing experiment? So perhaps this could be connection related even? In any case, for now things are working just fine!

Well done getting all these issues solved! fingers crossed it’s smooth sailing from here! :crossed_fingers: