I am using PsychoPy version 2020.2.10 on Mac OS Mojave 10.14.6. I have a task where a loop needs to terminate after a certain number of trials. I have been using trials.finished = True, and I have never been able to get it to work locally.
I looked at this solution: Loop.finished=true No longer working - #15 by TomH and as part of the troubleshooting, I tried setting trials.finished = True without any “if” statements to force it to end at the begin routine and also at the end routine. I also tried with the name of my routine. Neither worked, and the error message I got was “NameError: name ‘trials’ is not defined,” or similarly, “NameError: name ‘myloopname’ is not defined.”
I tried this method Builder - terminating a loop — PsychoPy v2020.2 where I set up a counting variable and used if statements, and I tried just forcing it to end by setting trials.finished = True.
It appears to me trials.finished is not working. Am I misunderstanding something? Is there another way to end loops?