| Reference | Downloads | Github

Numeric data outputting as string

Hi all,
I am having somewhat of a strange issue with respect to how psychopy is adding data to the output file. I have a task where subjects make a binary choice, and I want to record those key presses as a column in the output file (i.e., Response).

While the key press responses are being recorded and placed in the output file, on some trials they seem to be getting recorded as a string, with quotes around them, (i.e., ‘2.0’) and on other trials they seem to be recorded as an integer (i.e., 2), even for the same trial types. Anyone happen to have a thought as to why this might be occurring? I have code explicitly converting them to an integer (I think):

resp = event.getKeys(keyList = responseKeys)
resp_val = int(resp[0])

trials.addData(‘resp’, resp_val)

but I am stumped as to the reason for any inconsistency in recording of the values as strings or integers.

any suggestions would be much appreciated.