If you have a keyboard component called key_resp set to store the last key, then that key is key_resp.keys (which will be None if no key is pressed – can the routine end without a keypress?)
If you have a keyboard component called key_resp set to store the last key, then that key is key_resp.keys (which will be None if no key is pressed – can the routine end without a keypress?)