psychopy.org | Reference | Downloads | Github

Correct Answer Registered as Incorrect

Hi all,

I’m having issues getting my experiment to record the correct answer. It seems to be registering as incorrect no matter what.
I’m new to Psychopy so perhaps this has a simple fix?

OS: Windows 10
PsychoPy version: v2021.2.3
Standard Standalone? (y/n): y
What are you trying to achieve?: trying to get store correct answer

What did you try to make it work?:
I set “Correct answer” field to match the column of the correct answer in conditions.xlsx (CorrectAns)
image
image

What specifically went wrong when you tried that?:
However, the .corr column registers as 0.
image

Here’s the part of the python code that should correspond to logging the correct response, but I can’t seem to find anything wrong with it:
image

try

if CorrectAns in key_resp.keys:

Or simply put $CorrectAns in the Answer field of the keyboard component.

Thanks for the response.

I tried:
image

and it gave me a TypeError
TypeError: 'in ’ requires string as left operand, not float

So I tried:
image
But it just ended up giving incorrect again even though I was pressing the correct key (‘4’ for the first 2 trials).

For your second suggestion

Or simply put $CorrectAns in the Answer field of the keyboard component.

Was this not the correct way to do it (pic below)? This is the key_resp properties.
image