psychopy.org | Reference | Downloads | Github

Separate log file for each block

We run multiple blocks of trials in the same run of the experiment. I would like to have PsychoPy create and write to a different log file for each block of an experiment. Is this possible? I like PsychoPy’s logging functions and would rather not write to the logs manually if I can help it.

I have tried running logging.LogFile() with a different filename at the start of each block. But all the files end up with identical text, possibly because I haven’t found a way to close the old log before I start the new one.

Thanks in advance for your help!

The API is here:

http://www.psychopy.org/api/logging.html

I’m not familiar with it, but can you use .LogFile() to specify a new file destination at the beginning of each block?

Yeah, I’ve been working off that documentation, and that’s what I tried.

I tried running logging.LogFile() with a different filename at the start of each block. But all the files end up with identical text, possibly because I haven’t found a way to close the old log before I start the new one.