Experiment won't run online (permission denied when syncing with web project)

URL of experiment: PsychoPy test 1.1 [PsychoPy]
PsychoPy version: v2022.1.4

Description of the problem: My experiment is working perfectly locally, but I can’t get it working online. When I first clicked ‘Run online’ it seemed to upload correctly (although a blank screen appeared in my browser). When I click ‘pilot’ the same blank white screen appears. And back in PsychoPy, when I click ‘Sync with web project’, I get the following error message:

Traceback (most recent call last):
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\builder\builder.py”, line 1373, in onPavloviaSync
self.fileExport(htmlPath=htmlPath)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\builder\builder.py”, line 808, in fileExport
self.generateScript(experimentPath=exportPath,
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\scripts\psyexpCompile.py”, line 71, in generateScript
compileScript(infile=exp, version=None, outfile=filename)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\scripts\psyexpCompile.py”, line 245, in compileScript
_makeTarget(thisExp, outfile, targetOutput)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\scripts\psyexpCompile.py”, line 217, in makeTarget
script = thisExp.writeScript(outfile, target=targetOutput, modular=True)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\experiment_experiment.py”, line 286, in writeScript
self_copy.settings.writeInitCodeJS(script, self_copy.psychopyVersion,
File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\experiment\components\settings_init
.py", line 834, in writeInitCodeJS
with open(os.path.join(folder, “index.html”), ‘wb’) as html:
PermissionError: [Errno 13] Permission denied: ‘C:\Users\ianja\OneDrive\MA\Dissertation\PsychoPy Experiment 1.0\Experiment 1\index.html’

Any ideas what’s wrong and how I might fix it?
Any help greatly appreciated!
Ian

Hi Ian,
have you checked the JS console in your browser’s developer tools when you open the study online? If there’s an issue with your JS code, you can see the error messages there. :slight_smile:

Thanks so much for your reply Merle! I’ve checked that and it does indeed have some errors (see below), which mostly seem to be failures to load resources. Unfortunately I have no idea how to fix them. (EDIT: I’m using Chrome on Windows 10 by the way in case that’s helpful.)

Failed to load resource: the server responded with a status of 404 ()
/I/exp1/index.html/lib/psychojs-2022.1.4.js:1 Failed to load resource: the server responded with a status of 404 ()
DevTools failed to load source map: Could not load content for chrome-extension://gighmmpiobklfepjocnamgkkbiglidom/browser-polyfill.js.map: System error: net::ERR_FILE_NOT_FOUND
psychojs-2022.1.4.css:1 Failed to load resource: the server responded with a status of 404 ()

You might have to tweak your JS code a bit & download the missing resources to make this work. Have a look at this crib sheet: PsychoPy Python to Javascript crib sheet 2021 - Google Docs
You can find something on the PolyFill error on page 2, I guess that should fix it.

Thanks for this suggestion! Sadly I can’t seem to find the line of code page 2 suggests replacing. Under the ‘Before Experiment’ section I only have this:

// Start code blocks for ‘Before Experiment’
// init psychoJS:
const psychoJS = new PsychoJS({
debug: true
});

I also noticed the crib sheet says “N.B. From version 2021.2.3 onwards, most of these functions should auto translate correctly without defining anything in code_JS.” I’m using v2022.1.4 so perhaps this isn’t the problem in my case.

I’ve also tried moving the experiment folder out of my Onedrive directory (having read that “Each Builder (psyexp) file should be in its own dedicated local folder, which should not be in an area currently under version control (e.g.a github project, Google drive or Onedrive).”), but still the same problem persists. Any other ideas?

Hi, just by looking at the last line of the error message, it seems to be saying that it does not like the html file. Do you have a html folder with your resources in it or do you have index.html not within a folder (i.e. same location as your psyexp file)

Hi Sue, thanks for your reply! The experiment’s ‘master folder’ contains the following:

  • My PsychoPy Experiment file
  • An ‘index.html’ folder (containing a html file and 2 JavaScript files)
  • The pictures and Excel (conditions) files for my experiment
  • A ‘data’ folder
  • A hidden ‘.git’ folder
  • A ‘.gitignore’ file, a ‘lastrun.py’ file, and a ‘readme.md’ file

Seem to have fixed it! Will explain what I did in the next post. Thanks for all your help everyone.

After moving the experiment folder to a location that wasn’t within my OneDrive directory, I deleted all the files from the old location, deleted all of the online-related files & folders in the experiment folder (the ones that had been generated in my first upload attempt), and deleted the experiment from Pavlovia. After trying to Sync afresh, the experiment now worked perfectly in a Pavlovia pilot run. So I guess the experiment’s original location on my hard-drive was the main issue (and copying to a new location wasn’t enough).

I also disabled AdBlock as this also seemed to be causing an error of some sort, but since reactivating it the experiment is still working in Pavlovia so I don’t think that was the main problem.