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 =
.
Bank==2000
# Change it to -->
Bank=2000
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
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\builder.py”, line 1206, in runFile
self.app.runner.panel.runLocal(event)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\runner\runner.py”, line 729, in runLocal
procStarted = self.runFile(
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\runner\scriptProcess.py”, line 122, in runFile
stdOut.write(runMsg)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\console.py”, line 112, in write
self.broadcast(text=text)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\console.py”, line 139, in broadcast
lf.write(text)
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?
hi,
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
Hey,
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
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.
Thanks
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
thank you! I do really appreciate it you wouldn’t know!
coming with another problem feels never ending!
line 873, in
text_4.setText(choiceStr(Msg)
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
Haha, no problem
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.
Hello,
This text component is fine:
$'Your Current Total: £' + str(Bank)
I was referring to the text components in your Feedback
routine:
$choiceStr(Msg)
The function choiceStr
is not an existing function. My question is, why are you using it?
The Msg
variable is already a string:
if(Outcome>0):
PlusMinus=('+ £')
Msg='YOU WON!!!'
DisplayMoney=abs(Outcome)
elif(Outcome<0):
PlusMinus=('- £')
Msg= 'YOU LOST!!!'
DisplayMoney=abs(Outcome)
So you can type $Msg
:
Let me know if it fixes your problem
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
I HAVE DONE IT
ALL FINISHED
IM SO HAPPY
No more programming for me haha
thank you for all your help
Happy I could help!
Good luck with your experiment
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.
Thanks,
Chen