File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
pyomo/solvers/plugins/solvers Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -239,10 +239,13 @@ def available(self, exception_flag=True):
239239 def _apply_solver (self ):
240240 StaleFlagManager .mark_all_as_stale ()
241241
242- if self ._tee :
243- self ._solver_model .setParam ('LogToConsole' , 1 )
244- else :
245- self ._solver_model .setParam ('LogToConsole' , 0 )
242+ # We would like to just set OutputFlag to turn off the console
243+ # log, but that prevents users from using the Gurobi LogFile
244+ # option (see #3589 / #3716). BUT just setting LogToConsole
245+ # triggers Gurobi to write a message to the console. We will
246+ # capture that message here:
247+ with capture_output (capture_fd = True ):
248+ self ._solver_model .setParam ('LogToConsole' , int (bool (self ._tee )))
246249
247250 if self ._keepfiles :
248251 # Only save log file when the user wants to keep it.
You can’t perform that action at this time.
0 commit comments