# Using expInfo in a code

**URL:** <https://discourse.psychopy.org/t/using-expinfo-in-a-code/18347>\
**Category:** Coding\
**Created:** [November 22, 2020, 10:28pm UTC](https://discourse.psychopy.org/t/using-expinfo-in-a-code/18347 "2020-11-22T22:28:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sammy\_Keuleers](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/sammy_keuleers/32/12472_2.png) [@Sammy\_Keuleers](https://discourse.psychopy.org/u/Sammy_Keuleers)\
**Post date:** [November 22, 2020, 10:28pm UTC](https://discourse.psychopy.org/t/using-expinfo-in-a-code/18347/1 "2020-11-22T22:28:42Z")

</div>

Hello everyone!

I’m building an experiment in PsychoPy for a course “Methods of Psychological Research” at the Catholic University of Leuven.

I am struggling with setting up a Python code.  
_Brief overview: I have a stroop task: depending on the “code” filled in in the expInfo - pop-up box in the beginning of the experiment a certain Text component is varied_

**if exp[‘code’]=0:**  
\*\* pause = “5 seconds pause.”\*\*  
**if exp[‘code’]=1:**  
\*\* pause = “You’re doing great.”\*\*  
**if exp[‘code’]=2:**  
\*\* pause = “You’re doing very bad.”\*\*

Whatever I try, this is not working, I tried expInfo[‘code’]=… as well.

Anyone who could help me?

I hope I explained my problem clear enough to you!

Thanks in advance!

Sammy

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [November 22, 2020, 11:17pm UTC](https://discourse.psychopy.org/t/using-expinfo-in-a-code/18347/2 "2020-11-22T23:17:00Z")

</div>

The problem is that expInfo gets stored as text not numbers so you need ==‘1’: etc.

I’m always getting tripped up by that.

[I note that you also had = (assigns value) not == (checks value)]
