UndboundLocalError: local variable referenced before assignment

Hello all,
I’m using PsychoPy 2023.2.3
Win 10 x64bits

I am having a few issues in my experiment, some of the errors I never saw in older versions of Psychopy

What I’m trying to do?
The experiment will show in the middle of the screen an abstracted stimuli (B1 or B2), and after valid click on it, the stimulus will remain on the middle of the screen and three more stimuli will appear in the cornor of the screen.

I’m having this erro (attached above), a simple error, but I can not see where the error is.
Also the experiment isn’t working proberly and is the old version (I don’t know but someone are having troubles with this version of PscyhoPy)?
ba_training_block.xlsx (13.8 KB)
SMTS.psyexp (91.6 KB)
stimuli, instructions and parameters.xlsx (12.8 KB)

You have a routine called sample but you also use that name for your image file in sample_box.

1 Like

Hi,

I changed the name of the routine for ‘stimulus_sample’ and manteined the image file in sample_box as ‘sample’.
But, the error still remain. But it do not happen all the time, this is very interesting…

Can u give it a look again? (I made some minor changes here)

Also, another error happens, but it do not happenn all the time, idk why?

Here the exp file
ba_training_block.xlsx (13.7 KB)
SMTS.psyexp (89.7 KB)
stimuli, instructions and parameters.xlsx (12.8 KB)

Thanks again

Please could you confirm/show the new error message? Is it definitely still related to sample?

And still are the same error:

I think you have blank rows in your spreadsheet. The loop claims that there are 19 conditions but I think you only want 12. Without a value for sample_category sample doesn’t get set. With random presentation this will happen at a random point.