I use psychopy2 v1.85.2 for my experiment in Mac. I have gotten a message after an experiment as follows and then have some trouble in inaccurate response.corr though getting an accurate response.keys in excel. Please tell me how to get accurate response.corr.
FutureWarning:elementwise comparison failed;returning scalar
instead,but in the future will perform elementwise comparison
if (response0.keys == str(correctAns0) or (response0.keys == correctAns0):
response0.keys
will return a list, even if it contains just a single value. This is why it is named .keys
rather than .key
. e.g. if the subject pushed the 'a'
key, the results would be the single element list ['a']
.
You should treat it as a list and make comparisons like yours to a specified single item within that list. e.g.
# test against the zeroth list item rather than the entire list:
if response0.keys[0] == str(correctAns0): # etc