| Reference | Downloads | Github

Error with condition file loop

OS (e.g. Win10):
PsychoPy version (e.g. 220201.3):

Hi, I am trying to program a basic auditory simon task. However, I cannot manage to include my condition file in the trial loop.
Belove you can find the error I get, and in the attachment the file I am trying to browse in the loop.trialList.csv (7.7 KB)

Traceback (most recent call last):
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\app\builder\”, line 1575, in onBrowseTrialsFile
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\data\”, line 417, in importConditions
(fileName, len(trialList), len(fieldNames)))
UnboundLocalError: local variable ‘trialList’ referenced before assignment

Could it be because your csv file uses semicolons rather than commas?

Does it work locally?

What does the loop definition look like?

Hi, I tried also with replacing the semicolons with commas, and it doesn’t work. Using a .xls file did not help elsewhere. This experiment will be run locally and at the moment it doesn’t run at all.
Here are the properties of the loop and the structure of the experiment 8which is really basic.

I did much more complex experiments in the past (even including code components), that’s why I am so confused about this not browsering the .csv

Ah – so the problem is that you can’t open the conditions file with the loop.

That is usually because you have a space somewhere in the column names or one of the cells has contents but not column header.

Looking at your file I can see a space in front of N_DIR_GAZE and N_1_DIR_GAZE

1 Like

Thank you! I was completely blind to that :sweat_smile: !
Now it works!

Cool. Please could you set my post as the solution?