I would like to capture in a file the standard output by a child Process spawned by an external package.
I can NOT simply redirect sys.stdout to a file, as this does not capture the output of new processes (How can I capture the stdout output of a child process?).
But unfortunately, I also can NOT simply use subprocess or the terminal to capture stdout, since I am not spawning the process -- it is spawned by the code in an external Python package.
Specifically, I am using the API to the package pystan. Some of the functions in this package spawn child MCMC runs that write to standard output.