Howdy, Stranger!

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

Supported by

Logging text box vars in python code w/ loggers present

A current task in development uses both an OpenSesame logger in a coroutine, as well as inline script for a word recall test. I would want to use just loggers or just inline script as it is less messy, however coroutines do not support script. In it's current state the task logs everything fine, including the two variables in the "probe_randomizer" script, with the exception of the text box variables and the continue button in the "Test_script_1".

However, when the experiment finishes, the variables in "Test_script_1" do appear in the variable inspector with the correct text that was input in each text box, just not in the final log file. I have attached a demo version of the task that includes the scripts I have referenced.


Comments

  • Hi @FurmanSleepLab ,

    You're very close. It's just the order in which you're executing these two lines in Test_script_1:

    (…)
    log.write_vars()
    form._exec()
    

    This first writes the current variables to the log file (i.e. the Python equivalent of a logger item), and only then executes the form. Therefore, the variables that are assigned during the execution of the form aren't logged. Switching the order of the statements around show fix this:

    (…)
    form._exec()
    log.write_vars()
    

    Hope this helps!

    — Sebastiaan

Sign In or Register to comment.