[solved] Custom log file error
Im working on a simple Stroop task with a Droid back-end and instead of the standard logger i want to use a custom log file with just a couple of variables. I use one inline_script at the start of the experiment that closes the log file and creates a new one with an updated participant number and begin by writing the header of the new file:
import codecs import os print log # Close current log file log.close() # Define the first log i = 0 print os.path.dirname(os.path.realpath('.')) while os.path.exists('/sdcard/Data/Stroop/subject-%d.csv' % i): i += 1 print i # Open the new log file with up to date participant number log = codecs.open('/sdcard/Data/Stroop/subject-%d.csv' % i, 'w', encoding='utf-8') print log # write header to log log.write("word,color,congruency,rt/n")
Then after the response for each trial i put another inline_script to write the variables i'm interested in according to the new syntax documentation:
var_list = [var.word,var.color,var.congruency] log.write_vars(var_list)
However, the script crashes after the first trial and the newly made log file remains empty. The debug text states that the 'file' object has no attribute 'write_vars'
Does anyone see what is going wrong?
Thanks in advance,