PsychoPy Error I Can't Fix

I have completed an Iowa Gambling task Experiment but it doesn’t run due to “bank” not being defined when I have defined it using “Bank=2000”. I’m not too sure how to fix this. can anyone help? Thanks
Decks.xlsx (10.3 KB)
IGT.psyexp (54.1 KB)

Hello Taylor,
You accidently typed == instead of =.

# Change it to -->

Thank you I completely didn’t notice!

its now giving this code DeckA.setImage(‘card.jpg’)
AttributeError: ‘int’ object has no attribute ‘setImage’
I don’t really even know what this means, Are you able to help please?


No problem :slight_smile:

About the error you receive, why are you setting your path in DeckA, DeckB, DeckC, and DeckD to set every repeat? Set it to constant.
Let me know if it fixes your error.

Hi,sir,can you tell me what happend to my computer?
Traceback (most recent call last):
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\builder\”, line 1206, in runFile
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\runner\”, line 729, in runLocal
procStarted = self.runFile(
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\runner\”, line 122, in runFile
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\”, line 112, in write
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\”, line 139, in broadcast
UnicodeEncodeError: ‘gbk’ codec can’t encode character ‘\xa0’ in position 46: illegal multibyte sequence

Hello @dr990613 ,
It would be better if you open a thread yourself; that way, we can focus on one problem at a time. It will also help to give more context to your errors; when are they happening?


sorry for the late reply had a HECTIC past few days!
that solved that problem but now another has arose, typical!
thisComponent.tStart = None
AttributeError: ‘int’ object has no attribute ‘tStart’
################# Experiment ended with exit code 1 [pid:1069] #################
I have no idea how to solve this!
thank you so much for your help

In your code_3 component, why are you printing the variable outcome? It doesn’t exist.
The Outcome variable exists.

(I commented it out. in your original code, it’s still part of the code)


After removing them, you will receive an error about the following:

Not sure what you were trying to do there :slight_smile:

Let me know if it works and if you need further assistant

Hi, thanks for getting back to me!

I am getting the exact same error message after getting rid of the print outcomes.

I have gotten rid of text 2. the whole point of that section of the experiment is to show the participants new bank balance and what the outcome of their card selection was (eg. +£100, -£250 etc).

I’m not sure what else to do. I’m attaching the updated file now.

IGT.psyexp (52.2 KB)

Hey, no problem.
After a lot of troubleshooting, I eventually found the problem.
You are using the names DeckA, DeckB, DeckC and DeckD both to your images and your conditions:


Simply change the names of your images :slight_smile:

thank you! I do really appreciate it you wouldn’t know!

coming with another problem feels never ending!
line 873, in
TypeError: ‘str’ object is not callable

my problem is not really knowing what the language means really. im a complete beginner who regrets programming haha

1 Like

Haha, no problem :slight_smile:
Mind sharing the updated version of the experiment?

If I remember correctly, you used the function choiceStr() inside your text component.
What is it? It’s not a function that is part of Python. I also didn’t see a custom function with this name inside your experiment.
What is the meaning of it?

$'Your Current Total: ’ + ‘£’ + str(Bank)
im using it to show the choice the participant made and their new bank balance. I saw it done this way online as I wasn’t t sure how to make this work.

This text component is fine:

$'Your Current Total: £' + str(Bank)

I was referring to the text components in your Feedback routine:


The function choiceStr is not an existing function. My question is, why are you using it?
The Msg variable is already a string:

    PlusMinus=('+ £')
    Msg='YOU WON!!!'
    PlusMinus=('- £')
    Msg= 'YOU LOST!!!'

So you can type $Msg:

Let me know if it fixes your problem :slight_smile:

that worked!

I got past choosing a card and it telling me my new balance but got stuck with this code line 964, in
ChoiceBlock.addData(‘Chosen_Card’, CurrentCard)
NameError: name ‘ChoiceBlock’ is not defined

im trying to upload my updated file but it just isn’t uploading :frowning:



No more programming for me haha

thank you for all your help


Happy I could help!
Good luck with your experiment :slight_smile:

How have you resolve your issue? Just curious.

Hey Maxi,
It will be best if you open a post with the specific problem you’re facing.
Taylor faced more than one issue during this discussion, so you need to be more specific for us to help you. For example, providing the error message.