how to work with unicode input from keyboard_response?
I use two keyboard_response objects to log two responses (for an identification task for two letters shown in the trial), and I then want to determine whether the letter matched any of the two letters shown, to create a score for each letter as having been seen or not.
To do so, I tried comparing the logged keyboardinput to the target letter, but there is a mismatch in case: Target is uppercase, this response is encoded in lowercase (turning on caps lock during run time does not help).
If I use str.upper(var.letterinput) to convert the input into uppercase, it says "exception message: descriptor 'lower' requires a 'str' object but received a 'unicode' "
Does anyone know how I can change the unicode encoding into string / compare an uppercase target letter to a lowercase input letter?
Comments
Hi Mark,
upper()is a method of astrorunicodeobject (which are both text objects) and you call them like so:So you call the method on the object, and don't pass the object as an argument. Does that clear things up?
So checking whether a response was correct would look something like this:
Cheers!
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Thanks for the quick and early response, works like a charm!