Error Unfortunately we encountered the following error: ReferenceError: os is not defined Try to run the experiment again. If the error persists, contact the experiment designer

URL of experiment: IAT-1.4 [PsychoPy]

Description of the problem: Hello,
I am working on an IAT experiment using the OpenIAT template (demos / OpenIAT · GitLab). After downloading the template (Psychopy V2024.2.3) and syncing it to Pavlovia, I encountered the following error:

ReferenceError: os is not defined
Try to run the experiment again. If the error persists, contact the experiment designer."

To resolve this, I exported the HTML from PsychoPy and modified the code to remove all os. references. I also came across suggestions on the forum to add “/” prefixes in the .os section which I implemented. However, I still got the error once I tried to rerun it on pavlovia.

I also carefully reviewed the .xlsx files and the PsychoPy trial routine code but did not find any remaining instances of os. references. Despite these adjustments, the experiment still produces the same error.

Is there something I might be missing? I have looked over other forums regarding this issue but couldn’t find much. I would greatly appreciate any guidance or advice on how to fix this, as I am new to PsychoPy and still learning. Thank you!(:

I don’t see any references to the os library in the code elements, so I think this is just an issue of it being four years old and the code needing a rebuild. That’s not hard, fortunately.

I would open the .psyexp file in PsychoPy and tell it to rebuild the JS code (the little yellow square with JS at the top) and then resync your experiment to Pavlovia, then try running it from Pavlovia (i.e., not using the PsychoPy app on your own computer, which will try to run it in Python instead; you can rebuild the Python as well if you want to do that).

Hi,
I opened the project, rebuild the JavaScript code, and resynced the experiment to Pavlovia. However, the issue continues—the script continues to override changes, even when deleted, synced, and re-deleted. This results in the same OS error.

Have you removed html from the output path? The link in your first post has /html/ in it.

Hello,

Yes, I removed html from the output path, deleted the local folder, and the .git folder, and this resolved the issue! I also manually deleted anything referencing “OS” from the JavaScript code and re-synced the experiment. I also had to change the saving file names to the same as the file. This worked!

Now, I’m encountering a new error: [see attachment]

It seems this error is related to the deletion of the html folder. I’ve been scrolling through the forums and found some discussions about similar issues. I will follow up on those suggestions to fix it.

Thank you!