[SciPy-user] optimize.fmin_tnc - how to catch its output?

Marek Wojciechowski mwojc@p.lodz...
Mon Jul 21 04:13:53 CDT 2008

I tried to catch fmin_tnc output to a file in the following way:

    file = open('messages', 'w')
    stdout = sys.stdout
    stderr = sys.stderr
    sys.stdout = file
    sys.stderr = file
    res = optimize.fmin_tnc(..., messages=1)
    sys.stdout = stdout
    sys.stderr = stderr

But this does not work. I realized that fmin_tnc calls C routine which
probably uses its own stdout, stderr. Is there a way to catch its output? 

Marek Wojciechowski

More information about the SciPy-user mailing list