title: Simple rectangle experiment in psychopy
body: <p><a href="https://i.stack.imgur.com/1Z9pg.jpg" rel="nofollow noreferrer">enter image description here</a>I am trying to adapt an existing script to create a very simple experiment in psychopy in which the aim is that a rectangle with different colours and dimensions loops through the screen.</p>
  <pre><code>&lt;**from psychopy import core, visual, event
  import csv
    
  ## Setup section, read experiment variables from file
  win = visual.Window([400,300], monitor=&quot;testMonitor&quot;, units=&quot;cm&quot;, fullscr=False)
  stimuli = []
  datafile = open(&quot;stimuli.csv&quot;, &quot;rt&quot;)
  reader = csv.reader(datafile, delimiter=&quot;;&quot;)
  for row in reader:
      if len(row)==2:         # ignore empty and incomplete lines
          size = float(row[0])  # the first element in the row converted to a floating point number
          color = row[1]        # the second element in the row
          stimulus = visual.Rect(win, width=size, height=size)
          stimulus.fillColor = color
          stimuli.append(stimulus)
  datafile.close()
    
  ## Experiment Section, use experiment variables here
  for stimulus in stimuli:
      stimulus.draw()
      win.flip()
      core.wait(1.000)
   
  ## Closing Section
  win.close()
  core.quit(**)&gt;
  </code></pre>
  <p><a href="https://i.stack.imgur.com/1Z9pg.jpg" rel="nofollow noreferrer">I also have an excel file in csv formt which contains the dimensions (in first column) and color (second color) of the rectangel</a></p>
  <p>However, I get the following error:</p>
  <pre><code>“File “C:\Users\USER\OneDrive\Área de Trabalho\psychopy\new_coding\untitled.py”, 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.
  </code></pre>
  <p>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.</p>