psychopy.org | Reference | Downloads | Github

Unicode error loading .csv in survey form

I’m creating a questionnaire using the survey form component.
I’ve done this previously with success but am continually getting an error this time that I think is related to my csv file.
If anyone is familiar with this error I’d be very grateful for help.

Most likely your csv file is not in utf-8 format (e.g. it’s been saved in a character set like Latin-1 instead). Options are to:

  • resave the file and check carefully what the character format is as you save it (character sets are usually an option you can select)
  • save as an xlsx file instead, which is more likely to save information about the formatting within itself so you don’t have to worry so much

Thanks for the response @jon

I changed the .csv to a .xlsx but I’m now getting a NameError:
“NameError: Use the following fields/column names for Forms…
[‘index’, ‘responseWidth’, ‘layout’, ‘questionText’, ‘type’, ‘questionWidth’, ‘options’]”

These are the fields I’ve used.
Is there anything else that could be causing this?

There’s surely something wrong in your file. Could you upload here for us to check it out? thanks

Of course. I’ve uploaded the csv file.
Apologies if it’s something very obvious.

debq.csv (3.9 KB)

Hi @jemmasedgmond, this is because the version of PsychoPy you are using does not support Form colour customisation - this was a new feature in 3.2.4. The attached should work.debq.xlsx (11.1 KB)

Thanks @dvbridges - that’s all working now!
Is there any other way of changing the colour of the text? Due to the rest of my experiment my background is white meaning the question text isn’t showing on the screen.

Or would it just be easier to update the version of psychopy I’m using?

You can upgrade, and you can also use the following code in the Begin Experiment tab of a code component:

for item in YOURFORMNAME.formElements['question']:
    item.color = "green"

for item in YOURFORMNAME.formElements['response']:
    item.line.color = "red"
    item.tickLines.colors = "green"
    item.marker.color = "blue"
    for label in item.labelObjs:
        label.color = "black"
 

Fantastic! Thanks again.