Wrong experiment runs online

I have repeated the process for the Toy experiment.
when I try to run it t I get 403 Forbidden.
When I had that problem before it was because the experiment was in a sub directory. Any idea?

Are there any errors output to Runner window when you do the html export?

I got the following:

Traceback (most recent call last):
File “C:\Program Files\PsychoPy3\lib\runpy.py”, line 193, in _run_module_as_main
main”, mod_spec)
File “C:\Program Files\PsychoPy3\lib\runpy.py”, line 85, in _run_code
exec(code, run_globals)
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\scripts\psyexpCompile.py”, line 250, in
compileScript(args.infile, args.version, args.outfile)
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\scripts\psyexpCompile.py”, line 242, in compileScript
makeTarget(thisExp, outfile, targetOutput)
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\scripts\psyexpCompile.py”, line 214, in makeTarget
script = thisExp.writeScript(outfile, target=targetOutput, modular=True)
File “C:\Users\phili\AppData\Roaming\psychopy3\versions\psychopy\experiment_experiment.py”, line 216, in writeScript
localDateTime, modular)
File "C:\Users\phili\AppData\Roaming\psychopy3\versions\psychopy\experiment\components\settings_init
.py", line 529, in writeInitCodeJS
self.prepareResourcesJS()
File "C:\Users\phili\AppData\Roaming\psychopy3\versions\psychopy\experiment\components\settings_init
.py", line 525, in prepareResourcesJS
shutil.copy2(srcFile[‘abs’], dstAbs)
File “C:\Program Files\PsychoPy3\lib\shutil.py”, line 257, in copy2
copyfile(src, dst, follow_symlinks=follow_symlinks)
File “C:\Program Files\PsychoPy3\lib\shutil.py”, line 121, in copyfile
with open(dst, ‘wb’) as fdst:
PermissionError: [Errno 13] Permission denied: ‘C:\Users\phili\OneDrive\Desktop\PsychoPyFiles\ToysExperiment\html\resources\photos\Elaine.jpg’
7431.6770 INFO C:\Program Files\PsychoPy3\pythonw.exe -m psychopy.scripts.psyexpCompile C:\Users\phili\OneDrive\Desktop\PsychoPyFiles\ToysExperiment\ToyOnline.psyexp -o C:\Users\phili\OneDrive\Desktop\PsychoPyFiles\ToysExperiment\html\ToyOnline.js -v latest

I think it is because the path is ‘/’ on the PC and ‘’ online. I thought I made all the changes but checking again.

1 Like

The only way I could get it create the .js file in the html folder was to move some of the photos up to same level as the experiment.
I have created 2 excel files, one to run on the PC and another to run online. They contain paths to where the photos are kept. The online version of the file uses the “/” instead of the “”
When I try to run the experiment I get the following error. which does not make much sense because thisExp is defined and was also used in the Bunny experiment which works online.

  • ReferenceError: thisExp is not defined

I remember in my Bunny experiment I had to add some js code at the beginning of the experiment which was recommended by Wakefield Morys-Carter’s crib sheet. That fixed the thisExp problem.

thisExp=psychoJS.experiment;
win=psychoJS.window;
event=psychoJS.eventManager;
shuffle = util.shuffle;
Array.prototype.append = [].push;
console.log(‘test’);

I am still having the problem where the resources, i.e. photos are not being found. The only way I have been able to fix it is to put copies at the level of the experiment before exporting.
There must be an easier way because I have a lot of photos in the file structure under the photos folder.

The permission error suggests there is an issue moving your resources. PsychoPy may not have permission to copy the files to the resource folder - you could try changing the read write access to your exp folders to give write permission to Psychopy. The reference error above suggests the was an error compiling the code, as you should not have to declare those variables.

I found out that I had a couple of other places where I was using the windows path () instead of the online file path (/). Once I fixed that I got onto the next problem reading in the conditions file which I will address in another post.
Thankyou very much for all your help

1 Like

My experiment has many image files. What I found is that some of them were read-only which is not a problem when run locally but when exporting to HTML of course the files could not be copied.