How can I deal with this error?

OS** (e.g. Win10): Win10
PsychoPy version** (e.g. 1.84.x): v2021.2.3

Traceback (most recent call last):
File “D:\psychopy 2021.2.3\lib\site-packages\psychopy\experiment\components\keyboard_init_.py”, line 245, in writeFrameCode
keyList = eval(allowedKeys)
File “”, line 1
[space’]
^
SyntaxError: EOL while scanning string literal

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “D:\psychopy 2021.2.3\lib\site-packages\psychopy\app\builder\builder.py”, line 1192, in runFile
self.app.runner.panel.runLocal(event)
File “D:\psychopy 2021.2.3\lib\site-packages\psychopy\app\runner\runner.py”, line 689, in runLocal
exp=self.loadExperiment())
File “D:\psychopy 2021.2.3\lib\site-packages\psychopy\scripts\psyexpCompile.py”, line 74, in generateScript
compileScript(infile=exp, version=None, outfile=filename)
File “D:\psychopy 2021.2.3\lib\site-packages\psychopy\scripts\psyexpCompile.py”, line 247, in compileScript
_makeTarget(thisExp, outfile, targetOutput)
File “D:\psychopy 2021.2.3\lib\site-packages\psychopy\scripts\psyexpCompile.py”, line 226, in makeTarget
script = thisExp.writeScript(outfile, target=targetOutput)
File “D:\psychopy 2021.2.3\lib\site-packages\psychopy\experiment_experiment.py”, line 232, in writeScript
self_copy.flow.writeBody(script)
File “D:\psychopy 2021.2.3\lib\site-packages\psychopy\experiment\flow.py”, line 235, in writeBody
entry.writeMainCode(script)
File “D:\psychopy 2021.2.3\lib\site-packages\psychopy\experiment\routines_base.py”, line 404, in writeMainCode
event.writeFrameCode(buff)
File "D:\psychopy 2021.2.3\lib\site-packages\psychopy\experiment\components\keyboard_init
.py", line 248, in writeFrameCode
self.params[“name”], “Allowed keys list is invalid.”)
psychopy.experiment.utils.CodeGenerationException: resp_prac_final2:

I met such error when running the experiment. What should I do to deal with it?
Any responses are appreciated.

Try looking at the keyboard component called resp_prac_final2.

Make sure the field “Allowed Keys” is either empty or something like “left, right, a, b” depending which keys you want to monitor.

Hope this helps.

1 Like

Is there a backtick at the end of space?

2 Likes

Yes it really helps! Thank you very much!

Yes that’s the problem. I have added one. Thank you very much!