Simple rectangle experiment error

Dear experts,

I am new to coding and I am trying to adapt an existing script for a very simple experiment in which the aim is that a rectangle with different colours and dimensions loops through the screen.
stimuli.csv (43 Bytes) (855 Bytes)

However, I get the following error:

“File “C:\Users\USER\OneDrive\Área de Trabalho\psychopy\new_coding\”, line 11, in

size = float(row[0]) # the first element in the row converted to a floating point number

ValueError: could not convert string to float: ‘3’

Experiment ended.

I attach the script and the excel files (which contains the rectangle dimensions and colours). I have tried several options including changing the dimensions in the excel files without decimals but the error message held.

Can anyone help in this regard?

Much appreciated


That’s the Byte Order Mark being picked up, it sits at the beginning of a file and is used to determine the file encoding. Try changing the call to open to:

datafile = open("stimuli.csv", newline='', encoding='utf-8-sig')

Thank you for your help it worked

1 Like