PsychoPy v2021.2.3
Windows 10
At the beginning of an experiment parameters to be used during two separate later routines are set in the begin experiment tab of a coder block as follows:
contr_set = [1 - float(expInfo['Contrast Level']), 1]
ori_set = [5, -5, float(expInfo['Orientation Level']), -float(expInfo['Orientation Level'])]
As you can see, this references two values entered in the popup dialogue box at the start of each experiment. Later on, values from the two lists above are selected for use as opacity values or orientation values (respectively, for a grating stimuli) using a .xlsx file, as to randomize which value is chosen each trial. Specifically, to do this ori_set[oriLeft]
for example is put as the orientation property, where oriLeft is a number 0 through 3 which will select a value from the list.
The first routine this is done in works without any issues. Then, later in the experiment, a separate, but identically constructed routine, alone in its own loop throws the error message:
gaborLeftTrippleTask.setOpacity(contr_set[contrLeft2])
TypeError: list indices must be integers or slices, not float
##### Experiment ended. #####
Why would I only be getting this error for the second but not first routine these parameters are referenced? I have rebuilt the routine several times, checked that everything is spelled correctly, and that presets are correct. Also, it is important to know that two separate .xlsx files are being used for the first and second routines but that they are nearly identical, and I have checked that they are being referenced correctly.
I do have several other code components between the first and second routine, is it possible one of them is interfering? --I don’t see why any should, only one other uses a list, and it is a completely different variable.
Any advice is much appreciated.