Error 13: Permission denied

Please clarify the problem in this error message:
'Traceback (most recent call last):
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\builder\builder.py”, line 1369, in onPavloviaSync
self.fileExport(htmlPath=htmlPath)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\builder\builder.py”, line 804, 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 857, in writeInitCodeJS
with open(os.path.join(folder, “index.html”), ‘wb’) as html:
PermissionError: [Errno 13] Permission denied: ‘C:\new spr ms experiment\three experiments for the main study\test 3\index.html’

Hello

The error message tells you that you are not allowed to write index.html to “C:\new spr ms experiment\three experiments for the main study\test 3” Any idea why you might not have write permissions?

BTW, try to avoid folder names with spaces. They may no always work.

Best wishes Jens

On most computers experiments should be created in subfolders of a documents folder. Writing to the root folder requires admin access.

I removed the spaces between the folders’ names, the error box still shows, and the experiment opens a blank page when I run it online and it does not proceed. Please note that I have a similar experiment to this one (a copy of it) just with different examples ‘stimuli’ and the other one does not have this problem. Please advise.

Error box:
Traceback (most recent call last):
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\builder\builder.py”, line 1369, in onPavloviaSync
self.fileExport(htmlPath=htmlPath)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\builder\builder.py”, line 804, 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 857, in writeInitCodeJS
with open(os.path.join(folder, “index.html”), ‘wb’) as html:
PermissionError: [Errno 13] Permission denied: ‘C:\new_spr_ms_experiment\three_experiments_for_the_main_study\test_3\index.html’

Thanks for the notice, I do have it in a subfolder. It still shows the error message.

Hello

Have you checked that you have write permission? What happens if you move the folder to your Documents folder, as suggested by @wakecarter?

Best wishes Jens

1 Like

This is not a documents folder.

May you please clarify what do you mean by ‘write permission’ and where do I find it? I am not very advanced yet in PsychoPy.

Best wishes
Najat

Thank you for the clarification. I tried to do that, but I faced another problem. My documents folder is typed in characters/letters that are not English which is something I cannot change, and PsychoPy doesn’t run experiments saved in folders with such characters.

On the other hand, I have other experiments saved in the same location of this experiment and they are working online.

Hello Najat

The operating system grants you write permission. It has nothing to do with PsychoPy. It looks like you are using a windows-based PC. So google “write permission Win”

Best wishes Jens

Hello Jens,

Thank you for the information,

I checked the permissions of this experiment and permissions of similar experiments, and they were the same, only that this experiment is not working. Plus, I tried to adjust the permissions following the instructions I found but nothing changed it somehow returned everything as it is once I close the properties box.

Please advise,

Can I upload the files for you to check them for yourself?
Best wishes,
Najat.

Hello

You should be able to upload the experiment, but without the stimuli and condition files, no one will be able to run it. So if you have many stimuli and condition files, it is best to create a toy version of your experiment that throws the same error.

Best wishes Jens

Hello Jens,

This experiment was copied from another folder and saved in a new one in a new location with all the necessary files as a new project, because I am designing 3 identical experiments with different examples. Maybe ‘copying’ made the problem. So, now I am just building a new one from the beginning.

Is there a way to build a template which I can copy to 3-4 projects with different examples but the same structure?

Best wishes,
Najat.

Hello Najat

I am afraid that you are making your experiments more complicated than necessary. There is probably no need to create three identical experiments with different examples. Try to familiarise yourself with PsychoPy by reading the references I posted in your other post. Having only one experiment with different examples makes debugging and maintenance easier.

For instance, you could use two loops surrounding each other. One loop loads one condition-file which contains a reference to another condition file. The latter condition-file then loads the stimuli of one experiment.

Or you could set the value of a variable at experiment start which determines which experimental stimuli are presented.

Best wishes Jens

Hello Jens,

Thank you for the information,

But then how will the participants complete a specific experiment with a specific stimuli? As I will save it as a single project.

Best wishes,
Najat.

في جمعة، ١٥ نوفمبر، ٢٠٢٤ في ٠٠:١٠، كتب Jens Bölte via PsychoPy <notifications@psychopy.discoursemail.com>:

Hello Najat

In the case of an identical experiment with different stimuli, you could use the following

Begin experiment

stimList = " "

if int(expInfo['participant'][:2]) % 4 == 0:
    stimList = "Liste4.xlsx"
elif int(expInfo['participant'][:2]) % 3 == 0:
    stimList = "Liste3.xlsx"
elif int(expInfo['participant'][:2]) % 2 == 0:
    stimList = "Liste2.xlsx"
else:
    stimList = "Liste1.xlsx"

Then, in the appropriate loop, specify the condition files as follows

If you wish to run the experiment online, specify the stimulus list in the Online Tab of the Experiment Settings Menu.

Best wishes Jens

1 Like