Updated Psychopy and text input code no longer works

URL of experiment: https://gitlab.pavlovia.org/CAMaitland/socialmotivationandidentity

Description of the problem:
I reinstalled Psychopy with version 3.2.4 in order to try and fix an issue I was having with videos and compiling scripts. This worked, but now some code for free input and display of text which previously worked no longer does.
The error message I’m getting is:

 n = len(theseKeys)
TypeError: object of type 'KeyPress' has no len()

As I said this worked previously so I’m not sure what I should try changing.

Hi @CAMait, yes theseKeys may now contain a KeyPress object for each keypress (see docs). So, you could instead use:

if theseKeys.name:
    # do something

Alternatively, you could rewrite your code to use the previous event module. See the textInput example :

1 Like