[solved] inline script logging fails
Hi,
because i collect this variables in another thread, I have this code in my script:
# log to experiment
def logToExperiment():
for x in toneStartLog:
print 'toneStartLog', x
exp.set('ToneStartTime_RTT',x)
for x in strokeResponseLog:
print 'strokeResponseLog', x
self.experiment.set('strokeResponse_RTT',x)
for x in responseTimeLog:
print 'responseTimeLog', x
exp.set('responseTime_RTT',x)
exp.set('keyStrokes_RTT',keyStrokes)
print 'keyStrokes', keyStrokes
the following is printed:
toneStartLog
12.0241760706
strokeResponseLog
12.96 (...)
responseTimeLog
0.94934 (...)
keyStrokes
51
I log the variables with a logger, but the logged file only says "NA" under all these variables.
Anybody knows why this is failing ?
Thanks in advance ![]()
Comments
Hi,
What you are doing with the
exp.setfunction is making a variable on the OpenSesame GUI level. This does not actually log the variable, nor it's value! What you probably want to do, is use the inline_script'sself.logfunction. See here for it's documentation.In your case, this would result in something like the following:
This wouldn't result in the prettiest log file ever, but you can of course think of other ways to do this! Another option is to create your own logfile:
Good luck!
Hi Edwin, thanks very much for the answer and help.
Yes i saw the possibility to log text, but this indeed would result in a non-handable logfile for later analysis.
My initial question was aiming at if it is possible log with loops, in this case I would have thought every assignment of a variable would be a new line in the log file but this is unfortunately not the case.
i ended up logging every single value to a variable (attaching a logger).
As a complete logfile with the other variables from the experiment is prefered, this solution is not pretty but acceptable.
I guess I just did not completely understand the logging concept of OS
Thank you very much!