I’m glad we found the source of your problem
Please mark my answer as the solution, if everything works now.
Regarding your ImportError: How did you install PsychoPy (are you using the standalone version), what version are you using and what is your operating system? The new keyboard class (from psychopy.hardware
) depends on the Psychtoolbox (ptb) package. There was an issue with older versions of PsychoPy, where ptb was not part of the standalone installation on windows (see here).
My suggestion of using the new keyboard class was just an optimisation. If you’re having problems, you can revert to using the psychopy.event.getKeys
function and everything should run without problems. From the warnings it appears that Psychopy does that in the background for you anyway, but you might want to change your code to get rid of the warnings.