Hi all,
is there a way of redirecting the output of dolfin functions, such as list_timings()
, to files in python? I want to log the complete output of a FEniCS program, and I need the python script to do it, so unfortunately redirecting the shell with &>
is not an option.
I tried to redirect sys.stdout
(and stderr
) but it doesn't work for the dolfin functions. I suspect the wrapped C++ functions simply don't use python's stdout
.
Anything I can do?
Minimal example:
import sys
from dolfin import *
sys.stdout = open('test.out', 'w')
sys.stderr = open('test.err', 'w')
list_krylov_solver_methods()
Cheers,
David