psychopy.org | Reference | Downloads | Github

How to prevent csv from creating columns for every comma in Experiment Info text fields

OS : Trisquel 8 (based off of Ubuntu 16.04 LTS)

Python version: Python 3.5.2

PsychoPy version : PsychoPy 3.0.7.

Standard Standalone? (y/n) : y

My csv data outpile file is creating a new column for every comma within the questions that I am asking participants in the Experiment Info dialog box. I understand that this is happening because of the nature of csv files, but it is an issue in regards to Experiment Info text fields because the response of the participants no longer match with the question asked when a single question is broken up into different columns. The only way I know how to avoid this is by putting all the questions in quotations, since the csv file will evaluate whatever is in quotations as text. However, I would prefer not to have all my fields within the questionnaire in quotations as I think it may look strange or even confuse participants. I’ve tried exploring changing setting of the csv file, but to no avail. The problem is that if I tell the csv file not to separate columns based on commas then all of the participant data collected throughout the trials are merged together in a single row.

Does anyone happen to know how to get around this? Any help is greatly appreciated.

Depending on how and where your questions go into the csv file, you could insert quotation marks around the question strings only just before they get written to the csv file. Something like this:

qforcsv = "\""+originalq+"\""

And then replacing originalq by qforcsv in the code that writes to your csv file.

Hi Mirjam,

I forgot to mention that I am using the Builder. Do you happen to know how I would be able to accomplish this in the Builder?

Thanks for your help.

I’m sorry, I’ve never used the Builder interface.