Skip to content

Commit

Permalink
More print statements and a nice flush
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmundt committed Jan 15, 2025
1 parent cbed907 commit b39867f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pyomo/scripting/driver_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,10 @@ def help_solvers():
with pyomo.opt.SolverFactory(s) as opt:
ver = ''
if opt.available(False):
print(f"Solver {s} is available.")
avail = '-'
if opt.license_is_valid():
print(f"Solver {s} has a valid license.")
avail = '+'
try:
ver = opt.version()
Expand All @@ -260,6 +262,7 @@ def help_solvers():
ver = '.'.join(str(v) for v in ver)
else:
ver = ''
print(f"Solver {s} reports version {ver}.")
except (AttributeError, NameError):
# Log that a solver was not found/skipped
print(f"Error retrieving version for solver: {s}")
Expand All @@ -282,6 +285,7 @@ def help_solvers():
_data.append((avail, s, ver, pyomo.opt.SolverFactory.doc(s)))
# Log the result
print(f"Solver: {s}, Availability: {avail}, Version: {ver}")
sys.stdout.flush()
finally:
# Reset logging level
logging.disable(logging.NOTSET)
Expand Down

0 comments on commit b39867f

Please sign in to comment.