| Reference | Downloads | Github

Key release as a reponse and record key duration

Dear all

**PsychoPy 3.1.0

I want to create an experiment, participants are required to press ‘v’ and ‘b’ keys, then press one of them when see the stimuli, and I want to record the key press duration.

I download the demo which was released in 2013 by Sol

Begin Experiment
from psychopy.iohub import EventConstants,KeyboardConstants,ioHubConnection,load,Loader
from import getDateStr

# Load the iohub device config, file converting it to a python dict.
io_config=load(file('iohub_config.yaml','r'), Loader=Loader)

# Add / Update the session code to be unique. Here we use the psychopy getDateStr() function for session code generation

# Create an ioHubConnection instance, which starts the ioHubProcess, and informs it of the requested devices and their configurations.

class=“attachment” href="//">ImitInhib_v0.psyexp (41.8 KB)

The problem is " FixtionClock= core.Clock()" is invalid syntax

It can’t run, I think it’s due to some grammer changes, but I can’t find it, could you please help me?

We can’t really see the match between the (partial) error message you provide and the code. But perhaps you should instead just try the new keyboard handling that became available in version 3.1 and which should be easier to use: