[open] Custom Logging/Output
I will be using OpenSesame as part of a cognitive training study (starting April 1), which involves subjects coming in for multiple sessions. I currently record and log Subject # and Session variables, but every time the same subject # is used, the logging file (e.g., subject-1.csv) is overwritten.
I could have the subject runners manually name the output files, but that introduces a lot of room for human error, especially with the amount of data that will be collected (hundreds of subjects completing 16 sessions each).
I would like to be able to either name the log file (sub_session_task.csv) or create a new custom output file from an inline script within the experiment. I've tried out a few commands that work from a Python terminal, but I haven't been able to create a text file from within OpenSesame using the Droid back-end on a Nexus 10. Any ideas?
Comments
You'll want to take a look at this discussion, which describes how you can choose custom logfile locations from within an
inline_script:In your case, the idea should be the same, but you'll have to make sure that you choose a writable location for the logfile, for example in the
/sdcard/folder (but it's somewhat device dependent). So ...... might become ...
Cheers!
Check out SigmundAI.eu for our OpenSesame AI assistant!
Thanks! I was able to get it to work based on the previous discussion and your suggested path. Here's the code that ended up working for me:
It's working perfectly. I'm curious about something, though. I have a folder with all my stimulus images called TaskImages. In my stimulus display inline, I have the following code.
But when I try to use a comparable command to define the output folder with a relative path, I get an error.
outputs this error in the debug file:
"IOError: [Errno 2] No such file or directory: './VisualSearchData/Sub0_Sess4_VisualSearchVers1_20140317175935.csv'
The script currently works great with the original script I attached at the top, so it's not critical, but I'm curious why './VisualSearchData' doesn't work.
The
./indicates that the path is relative to the current directory, which (under Android) is the app directory that you don't (usually) have write access to. So it's simply a permissions issue.Cheers!
Check out SigmundAI.eu for our OpenSesame AI assistant!