Loop condition set as a variable

If this template helps then use it. If not then just delete and start from scratch.

OS (e.g. Win10):
PsychoPy version (e.g. 1.84.x):
Standard Standalone? (y/n) If not then what?:
What are you trying to achieve?:

What did you try to make it work?:
In my experiment, I did not set up an excel file for the loop conditions, but used a list variable to define the conditions. For example,
training_con = [{‘feature1’: ‘sti/A1.png’, ‘feature2’: ‘sti/B1.png’, ‘feature3’: ‘sti/C1.png’, ‘corr_code’: ‘left’},
{‘feature1’: ‘sti/A2.png’, ‘feature2’: ‘sti/B2.png’, ‘feature3’: ‘sti/C2.png’, ‘corr_code’: ‘right’}]. Then I used the conditions in the loop in the builder. I set it to $training_con, and I set this variable in the module of begin experiment. I wanted to try whether this situation could be successful, but it kept reporting the error TypeError: stat: path should be string, bytes, os.PathLike or integer, not list.

What specifically went wrong when you tried that?:

It seems that it automatically reads an excel file for me, but if I don’t want to use excel, and just want to use variables similar to the above to define loops, can this be achieved when only the builder is modified?

If you are using a loop without a spreadsheet then leave Conditions blank.

Set Num repeats to the length of your conditions list and then use conditions[trials.thisN] (or perhaps in your case training_con[trials.thisN] ) to access the correct row of the list.