Error while executing inline script
in OpenSesame
Hello all!
I am getting the following error when I try to run the experiment.
The weird thing is that it only happens sometimes. Other times the experiment works completely fine. Any ideas?
Also, this is the inline script it is referring to:
#Increase total reward by amount of reward for that trial. Run only if [correct]=1 var.total_reward = var.total_reward + var.reward_value
Comments
Hey tnells,
I assume var.total_reward and var.reward_value are both supposed to be floats or integers but judging from the error output one of them isn't. Maybe you can print the variables or check their type() while running your experiment to see which one.
The reason why it sometimes work and sometimes doesn't may have to do with how you update the variables. Printing how the values change from trial to trial should also give you a clue under which conditions they turn into unicode.
Cheers,
michif
Hi Michif,
Thanks so much for your prompt response. I've been looking on OpenSesame's website to figure out how to print a variable or determine its type and have not found documentation on that. Do you have suggestions of where to start with that?
Much appreciated,
Nelly
Hi Nelly,
The reason you don't find anything on the Opensesame documentation is that it is not an Opensesame question. The code you write in
inline_scriptsis basically plain Python code, so in order to find specific commands regarding syntax, etc., you have to browse the Python documentation.Well anyway, what you need is the
printand thetypecommand. Use them like that:Hope this clears things up.
eduard