Code conversion problem in block loops

OS: macOS Monterey Version 12.4
PsychoPy version: v2022.1.3
Standard Standalone? (y/n): Yes
What are you trying to achieve?: a nested loop very similar to that described here.

What did you try to make it work?: Exactly as described. It should run, but when I look at the code, I can see that the variable I am try to pull from (which is defined by the outer loop (block) condition file) is called upon in line 152, where as the .xlsx file (analogous to “chooseBlocks.xlsx”) isn’t imported until line 734…

I can try and figure out how to solve this in the coder, but I would much rather keep working through the Builder for online conversion. Can someone help?

What specifically went wrong when you tried that?: Full error message below - it fails to load the experiment and quits before it begins (see above for the issue in the code)

File “/Users/emmalaurent/Desktop/grad/projects/replayInterference/experiments/0-Back/D1_AAA_0B/D1_AAA_0B_lastrun.py”, line 152, in
text=str(blockTarget),
NameError: name ‘blockTarget’ is not defined
################ Experiment ended with exit code 1 [pid:34865] #################

Hi @esl342, could you maybe upload your experiment file and the xlsx files?

Sure! Attaching the zipped folder below which includes the experiment, relevant files, as well as some additional error images.

D1_AAA_0B.zip (2.6 MB)

In target_text2, you have to set updating to “set every repeat” instead of “constant”. The Runner even gives you an alert :slight_smile:

1 Like

Ahaaaaa! Silly me. I see, so that is the equivalent of setting up a “for” loop in the coder. Thanks for your help!