If this template helps then use it. If not then just delete and start from scratch.
PsychoPy version: v2020 1.3
Standard Standalone? (y/n) y
What are you trying to achieve?: Specifying a variable list of allowed keys
I am specifying the allowed keys based on a paremeter in the excel input file that describes the type of the trial, as follows:
if (type == "vignette"): possibleKeys = ['space'] elif (type == "question"): possibleKeys = ['1','2','3','4','5'] else: possibleKeys = ['f']
(sorry, the necessary whitespaces are there in the script, but get taken out when posting)
The allowed keys are set to possibleKeys WITHOUT the $ that is otherwise use to set object properties,
as indicated in an earlier post on the topic.
The experiments starts running but stops when the key response is first activated, with this error,
called from the…last_run.py script
error in script at line 293: if not type(possibleKeys) in [list, tuple, np.ndarray]: if not isinstance(possibleKeys, str):
with the message:
TypeError: strObject not callable
(Btw, the same happens if I specify the list of possible keys as a variable in the input file)
The astonishing thing is, if I comment out the whole “if” statement that checks whether the list
of allowed keys is properly specifiied, the program works exactly as intended.
This, however, means that I have to do that every time I change something in the builder version.
PS: I checked for the error message online, and most forums say it has to do with “str” being used as a variable. However, I have not declared a variable with that name.