MacOS Catalina
PsychoPy 2020.1.2
Hello!
I am running into an issue setting up practice trials. In the first routine of my practice trials loop, I insert a code component and, in the BeginExperiment tab, I declare 2 variables as so:
total_acc = 0
total_num = 0
The total_num variable represents the total number of trials completed in the practice loop (there are two practice blocks, and the participant must go through both), and the total_acc is the trials with correct responses.
At the end of the practice loop, I have a feedback routine, still within the outer practice trials loop, with text feedback for a participant if they do not achieve a certain accuracy. I then set the nReps of the outer practice loop to something like 99, and break the loop only if the participant reaches a certain accuracy threshold. I inserted a code component, this time in the BeginRoutine tab of a code component in the feedback routine:
if(total_num == 50 and total_acc < 20):
skipThisTrial = False
continueRoutine = True
total_acc = 0
total_num = 0
elif(total_num == 50 and total_acc >= 20):
trials.finished = True
skipThisTrial = True
continueRountine = False
else:
skipThisTrial = True
continueRoutine = False
The problem I face is that I get an error message as shown below:
Just to clarify, I have an outer practiceLoop, then 2 loops for each block (i.e. block1Loop and block2Loop), and within those loops there is also a trialSequence loop. I understand I cannot end an outer loop from within an inner loop, however the above code is located only within the outermost practiceLoop.
Any ideas or suggestions about what may be going wrong here?
Thank you!
Daniel