If this template helps then use it. If not then just delete and start from scratch.
OS (Win11):
PsychoPy version (e.g. 2024.1.1):
Standard Standalone? (y/n) y:
What are you trying to achieve?: I try to run an experiment. It uses a loop and shows a stimulus and then the participant should react with a key press. Then the next trail begins. The key is different in each trail, so I added a excel file that defines the allowed keys per trial.
What did you try to make it work?: Searching the forum. All the related topics are not applicable or do not solve the error.
What specifically went wrong when you tried that?:
Basically, whenever I try to use the allowedKeys (variable names ‘Key’) via the file, I get the message
I don’t know the appropriate default value for a ‘allowedKeys’ parameter. Please email the mailing list about this error
and
UnboundLocalError: local variable ‘Key’ referenced before assignment
The file should be set up correctly, the keys are defined for example as [‘m’], and useing the file for different stimuli does work perfectly. Just not for the keyboard component.
I attache a minimal example:
Experiment
untitled.psyexp (14.4 KB)
Excel file
001_Test.xlsx (8.5 KB)
Help is much appreciated