NameError: name 'task' is not defined

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

OS (e.g. Win10): win 10
PsychoPy version (e.g. 1.84.x): 3.6
**Standard Standalone
What are you trying to achieve?: I am trying to dislplay a text from a condition file but it gives me an error message when i try to set the variable from the builder $task…I’m confused because instead if i want to display some images ($stim) from the same condition file it works. Additionally the first time i tried it worked so i don’t understand why is giving me this error. Please HELP :sob:

What specifically went wrong when you tried that?:
Traceback (most recent call last):
File “J:\Testing Online\TestingOnline_lastrun.py”, line 165, in
text=task,
NameError: name ‘task’ is not defined

I’ll upload the exp file with the condition file i’m using
ChooseSetA.xlsx (17.1 KB)
Imagelist1.xlsx (31.8 KB)
TestingOnline.psyexp (28.2 KB)

Hi, I noticed that your error originates from your Question 2 routine. This is because in your text component, you used $task and is currently set to “constant”. You need to set it to “set every repeat”. This should fix your “not defined” error

1 Like

Thanks! Now is working…but I still don’t understand why it happens. For example, this time I ran the experiment once and it worked but then I changed the selected rows for the $stim variable and when I tried again ‘NameError: name ‘stim’ is not defined’ now the error is for this other variable. Can you explain a little bit more from what is due this error, because apparently it happens many times and maybe there is something I am doing in the wrong way? Thanks for your help and kindness! :slight_smile: