# Error in variable names

**URL:** <https://discourse.psychopy.org/t/error-in-variable-names/20202>\
**Category:** Builder\
**Tags:** syntaxerror\
**Created:** [February 4, 2021, 4:26pm UTC](https://discourse.psychopy.org/t/error-in-variable-names/20202 "2021-02-04T16:26:56Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![daisyjane1008](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/daisyjane1008/32/13798_2.png) [@daisyjane1008](https://discourse.psychopy.org/u/daisyjane1008)\
**Post date:** [February 4, 2021, 4:26pm UTC](https://discourse.psychopy.org/t/error-in-variable-names/20202/1 "2021-02-04T16:26:56Z")

</div>

I have my experiment saved next to my Excel sheet in the same folder on my desktop. When I try to run it, I get the Name error “Name ‘cue’ is not defined”. Below is a screenshot of my excel sheet and the error that appears. Please let me know where I am going wrong. Thank you so much!!

 ![Screen Shot 2021-02-04 at 11.24.35 AM](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/e/f/ef0d1efc7ca06201922467e952b43e2c2fd71a3a.jpeg) ![Screen Shot 2021-02-04 at 11.24.58 AM](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/a/6/a6d2cf99564353d3b5e2e8753d644ce644997e50.jpeg)

---

<div class="post-metadata">

**Author:** ![JensBoelte](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jensboelte/32/9060_2.png) [@JensBoelte](https://discourse.psychopy.org/u/JensBoelte)\
**Post date:** [February 11, 2021, 10:58am UTC](https://discourse.psychopy.org/t/error-in-variable-names/20202/2 "2021-02-11T10:58:22Z")

</div>

Dear daisyjane1008

do you mind to share either your repository or a toy-version of your experiment (\*.psyexp, \*.xlsx, some \*.jpg). PsychoPy tells you that the variable **cue** is not defined. Where and how in your experiment do you refer to **cue**?

BTW, it often better to store an experiment in a hard-drive folder instead of having it in a folder on the desktop (also both are on a hardware technically speaking).

Best wishes Jens

---

<div class="post-metadata">

**Author:** ![daisyjane1008](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/daisyjane1008/32/13798_2.png) [@daisyjane1008](https://discourse.psychopy.org/u/daisyjane1008)\
**Post date:** [February 11, 2021, 3:27pm UTC](https://discourse.psychopy.org/t/error-in-variable-names/20202/3 "2021-02-11T15:27:18Z")

</div>

Hi Jens,

Thank you so much for your help. Above I had attached a screenshot of my excel file in which the variable “cue” is defined by a large group of images. Attached below is also the image file I had uploaded within PsychoPy in which I address this “cue” variable as $cue so that it will change to a different image for each trial. I have accurately defined it within my conditions Excel file as well as within the PsychoPy builder view. Please let me know what you think!

 ![Screen Shot 2021-02-11 at 10.26.15 AM](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/9/3/93eb6318ff8bef36f1d4c468fd8a373cd3f99a4a.jpeg)

---

<div class="post-metadata">

**Author:** ![JensBoelte](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jensboelte/32/9060_2.png) [@JensBoelte](https://discourse.psychopy.org/u/JensBoelte)\
**Post date:** [February 11, 2021, 3:35pm UTC](https://discourse.psychopy.org/t/error-in-variable-names/20202/4 "2021-02-11T15:35:43Z")

</div>

Dear Daisyjane

that looks ok. Did you check your Excel-file for trailing spaces in the column name **cue**?

Best wishes Jens

---

<div class="post-metadata">

**Author:** ![daisyjane1008](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/daisyjane1008/32/13798_2.png) [@daisyjane1008](https://discourse.psychopy.org/u/daisyjane1008)\
**Post date:** [February 11, 2021, 4:05pm UTC](https://discourse.psychopy.org/t/error-in-variable-names/20202/5 "2021-02-11T16:05:16Z")

</div>

Yes, I have checked for trailing spaces or any smaller errors within the column and there doesn’t seem to be any. Should I be referring to the conditions.xlsx file in some other way before calling variables from it?

---

<div class="post-metadata">

**Author:** ![JensBoelte](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jensboelte/32/9060_2.png) [@JensBoelte](https://discourse.psychopy.org/u/JensBoelte)\
**Post date:** [February 11, 2021, 6:55pm UTC](https://discourse.psychopy.org/t/error-in-variable-names/20202/6 "2021-02-11T18:55:00Z")

</div>

Hello,

do you mind giving access to your repository or upload your \*.psyexp and \*.xlsx-file along with some images, so that somebody else could test-run your experiment?

Best wishes Jens

---

<div class="post-metadata">

**Author:** ![daisyjane1008](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/daisyjane1008/32/13798_2.png) [@daisyjane1008](https://discourse.psychopy.org/u/daisyjane1008)\
**Post date:** [February 11, 2021, 7:10pm UTC](https://discourse.psychopy.org/t/error-in-variable-names/20202/7 "2021-02-11T19:10:41Z")

</div>

Hi Jens,

I haven’t made much progress on the actual PsychoPy experiment but attached below is the conditions file as well as the psychopy file. Thank you so much for your help!

Best,  
Jane

[conditions.xlsx](https://discourse.psychopy.org/uploads/short-url/dh1kfaxzy5ZIwCwVbOKSpCIEJ1U.xlsx) (84.2 KB) [thesis.psyexp](https://discourse.psychopy.org/uploads/short-url/9BgHWv9Bj8n48hdrAjfLLX5CVTN.psyexp) (7.5 KB)

---

<div class="post-metadata">

**Author:** ![JensBoelte](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jensboelte/32/9060_2.png) [@JensBoelte](https://discourse.psychopy.org/u/JensBoelte)\
**Post date:** [February 12, 2021, 9:02am UTC](https://discourse.psychopy.org/t/error-in-variable-names/20202/8 "2021-02-12T09:02:16Z")

</div>

Hello,

could you please upload image 012.jpg, 00120.jpg and 00121.jpg? Notice, all columns should be filled with values which isn’t the case for column G to U. Are these practice trials? You could save those in an extra Excel-file.

Best wishes Jens

---

<div class="post-metadata">

**Author:** ![daisyjane1008](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/daisyjane1008/32/13798_2.png) [@daisyjane1008](https://discourse.psychopy.org/u/daisyjane1008)\
**Post date:** [February 12, 2021, 5:19pm UTC](https://discourse.psychopy.org/t/error-in-variable-names/20202/9 "2021-02-12T17:19:24Z")

</div>

Hi Jens,

Yes, those are the practice trials. Attached below are the images.

 ![012](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/3/5/356f9b21c871755a36ad59e0a0298210a95e015f.jpeg) ![00120](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/8/e/8e7f2a1b8e243580d9b37a571540f57ac5e6f4f6.jpeg) ![00121](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/d/d/dd1f871c4aace526e3439b55119b0bc5310a78a8.jpeg)

---

<div class="post-metadata">

**Author:** ![JensBoelte](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jensboelte/32/9060_2.png) [@JensBoelte](https://discourse.psychopy.org/u/JensBoelte)\
**Post date:** [February 15, 2021, 11:15am UTC](https://discourse.psychopy.org/t/error-in-variable-names/20202/10 "2021-02-15T11:15:17Z")

</div>

Hello daisyjane

ok, the toy-experiment runs for me. I noticed that you scale your cuefile and your searchfile to a square. However, the cue and the two examples are 666 x 500 pixel large. So, you will distort the pictures. Furthermore, the file-extension were jpeg instead of jpg as specified in your Excel-file. Change all filename-extensions such that extension and reference match. Last but not least, I noticed that there is no loop in the screen-shot you presented above. You need to add a loop to your trials, otherwise PsychoPy does not know of your variables.

![grafik](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/3/a/3a893ca69ccf3f1a9da45275475ac6d3e4e88dab.png)

Use your Excelfile in the trials Property field Conditions.

![grafik](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/e/8/e8b52df66a1465e71074c262a37865c4ccff3b41.png)

Best wishes Jens
