Name error- name ' ' is not defined

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

OS (e.g. Win10): Win8
PsychoPy version (e.g. 1.84.x): v2020.2.10
Standard Standalone? (y/n) If not then what?: yes
What are you trying to achieve?: I want to build a recognition memory task. where I present an image stimulus and after a delay, I present two image choices, and subjects are asked to respond by choosing an image that was presented before the delay.

What did you try to make it work?:

I built an experiment where I have the image then delay and again an image trial and then a response.

What specifically went wrong when you tried that?:
my images are not read and are not read and it suggests that and the variable in the excel file is not defined.
Include pasted full error message if possible. “That didn’t work” is not enough information.

engine in PsychoPy prefs as the preferred audio engine. Its timing is vastly superior. Your prefs are currently set to use [‘sounddevice’, ‘PTB’, ‘pyo’, ‘pygame’] (in that order).
6.0743 WARNING User requested fullscreen with size [1024 768], but screen is actually [1366, 768]. Using actual size
Traceback (most recent call last):
File “C:\Users\SLRLAB19-3\Desktop\AV PhD task- 1 PschoPy\recog_task_lastrun.py”, line 217, in
enco_pract.setImage(cue)
NameError: name ‘cue’ is not defined

Experiment ended.

I’m new to PsychoPy, please help me to get through!

Thanks
Arpitha

Hi,

try adding the extension of the file (like cue.png).

tandy

Thanks, but it didn’t work.

This time I changed it to $cue.jpg but still, it didn’t work this is the error.

Hello from the pygame community. https://www.pygame.org/contribute.html
1.1924 WARNING We strongly recommend you activate the PTB sound engine in PsychoPy prefs as the preferred audio engine. Its timing is vastly superior. Your prefs are currently set to use [‘sounddevice’, ‘PTB’, ‘pyo’, ‘pygame’] (in that order).
24.1890 WARNING User requested fullscreen with size [1024 768], but screen is actually [1366, 768]. Using actual size
Traceback (most recent call last):
File “C:\Users\SLRLAB19-3\Desktop\AV PhD task- 1 PschoPy\recog_task_lastrun.py”, line 217, in
enco_pract.setImage(cue.jpg)
NameError: name ‘cue’ is not defined

Experiment ended.

I don’t know why PsychoPy is unable to find the path for image files. my variables are set in the condition file and the image folder is next to the experiment file (all with in a folder).
I wonder weather image experiments don’t work on some Laptops?

Is your image called cue.jpg ? If so, then remove the $

If cue is a variable without the extension, try $cue+’.jpg’

Thanks for your suggestions but, the properties - name - images don’t allow me to use any characters ( + ) in the blank.
I have a folder named ‘cue’ that is placed next to the psychopy exp file, within this ‘cue’ folder I have image items.
I named the variable as ‘cue’ in the condition file which is also placed next to pychopy exp file and the same name ‘cue’ is used in the image blank as ‘$cue’. image

So, if I have a folder then am I suppose to mention the path of the folder in the condition file and as well as the experiment builder?

Initially to avoid this name error I had pulled all the images from the folder and place them next to exp file but didn’t work.


Hello from the pygame community. Contribute - pygame wiki
1.9213 WARNING We strongly recommend you activate the PTB sound engine in PsychoPy prefs as the preferred audio engine. Its timing is vastly superior. Your prefs are currently set to use [‘sounddevice’, ‘PTB’, ‘pyo’, ‘pygame’] (in that order).
11.2465 WARNING User requested fullscreen with size [1024 768], but screen is actually [1366, 768]. Using actual size
Traceback (most recent call last):
File “C:\Users\SLRLAB19-3\Desktop\AV PhD task- 1 PschoPy\recog_task_lastrun.py”, line 217, in
enco_pract.setImage(cue)
NameError: name ‘cue’ is not defined

Experiment ended.

And all the images in the ‘cue’ folder have unique names (e.g. 1.jpg, 2.jpg,…) the same names are in each row of the excel condition file.

I don’t know why it is not able to pick up the images.