[SciPy-user] How to forbid a standard output of OpenOpt solvers
Mclean Edwards
mcleane at math.ubc.ca
Thu Mar 13 12:49:51 EDT 2008
On Thu, 13 Mar 2008, 302302 wrote:
> Hi,
> I've used linear solver (cvxopt_glpk) from OpenOpt. Can I somehow forbid a printing description of solving problem to the standard output?
> I supposed there should be some parameter in the running command, but I can't find any useful documentation with this topic.
>
My clunky solution to this problem in general is by defining a class:
class StandardOutputEater:
def write(self, string):
pass
Then when I need to disable standard output:
#turn off standard output
saveout = sys.stdout
sys.stdout = StandardOutputEater()
When you want standard output again, call:
sys.stdout = saveout
This gets the job done in all such cases.
This is also useful to quickly turn off some self-reporting messages every
once and a while. (Such as when you demo some code still under
development to an interested party.)
Cheers,
Mclean
More information about the SciPy-User
mailing list