Error feedback has syntax error

Hey so just a heads up, the psychopy error feedback code component, detailed here:
http://www.psychopy.org/recipes/builderFeedback.html
… has some sort of syntax error.

It works fine if you type for an incorrect or a correct response, but if a user doesn’t give a response, the experiment crashes and there is no “no response detected” feedback. The error message is:

if len(key_resp.keys) <1:
TypeError: Object of type 'NoneType' has no len()

Now I know just enough about python to just remove the “no response given” option so that non-reponses elicit the same feedback as errors, which stops the crashing problem, however seeing as this is offered on the website, someone should probably fix it. I don’t imagine it is a difficult fix for someone who knows something about programming.

Cheers.

Should probably be changed to

if not key_resp.keys:

If that fixes the problem, you are very welcome to edit the corresponding documentation source file on GitHub and file a pull request!

Hi Richard,
Yup that fixes the error message!
I don’t really know how Github works though, so I am about 70% sure that I registered the correction correctly.

Thanks,
Kyle

1 Like

Looks good to me!
xref: