unsupported operand type(s) for +: 'int' and 'unicode'
Good evening! I am new to all this OpenSesame world, so first of all sorry for my ignorance.
I'm working on an implementation of the Iowa Gambling Task, and everything was working fine, until this error just appeared, and I have no clue on how to solve it.
This is the error:
File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/inline_script.py", line 116, in run
self.workspace._exec(self.crun)
File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/base_python_workspace.py", line 124, in _exec
exec(bytecode, self._globals)
Inline script, line 17, in
And this the inscript it appears in:
Thank you!
Comments
Hi @babunidas ,
On line 17 you execute the statement
The error you see if because the data types of these variables are different and you can only use the + operator for variables of the same datatype. So either one of current, wins or loss is a string (which is used to store characters as text) while the other is numeric (int).
You can either try to determine which of these variables is a string and convert them to an integer, or just be safe and convert them all:
I hope this helps.