Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

coercing to Unicode: need string or buffer, int found


I'm designing an experiment in open sesame and I've encountered the following problem:
I'm defining a variable called total_correct_t inside a loop without any values.
I update it in this inline script:
if var.correct == 1:
var.total_correct_t += 1
Whenever that correct == 1 Im getting the error below. Is there any different way for defining variables in open sesame?
I feel like I'm missing something. It doesn't feel right to define the variables I want to document in the independent_variables table.


The error I got:

Error while executing inline script

item-stack: experiment[run].training_loop[run].block_sequence_t[run].block_loop_t[run].trial_sequence_t[run].update_total_correct_t[run]
exception type: TypeError
exception message: coercing to Unicode: need string or buffer, int found
item: update_total_correct_t
time: Wed Aug 22 11:01:49 2018
phase: run

File "/Applications/", line 96, in run
File "/Applications/", line 124, in _exec
exec(bytecode, self._globals)
Inline script, line 2, in
TypeError: coercing to Unicode: need string or buffer, int found


  • Hi Amir,

    i am not sure if that helps, but here some suggestions.
    Your operation += is not (yet) supported.
    Try to run just this code: total_correct_t += 1

    Implement the variable beforehand (maybe another inline_script)
    var.total_correct_t == 0

    Then use at your position this code: (be careful with indentation)

    if var.correct == 1:
        var.total_correct_t = var.total_correct_t +1

    Good luck

Sign In or Register to comment.