Skip to content

Commit

Permalink
fix UnknownSolver logic, missing import
Browse files Browse the repository at this point in the history
  • Loading branch information
jsiirola committed Aug 6, 2024
1 parent 9c744c7 commit 7ae66e3
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions pyomo/scripting/driver_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,16 +258,18 @@ def help_solvers():
ver = ''
except (AttributeError, NameError):
pass
elif isinstance(s, UnknownSolver):
elif s == 'py':
# py is a metasolver, but since we don't specify a subsolver
# for this test, opt is actually an UnknownSolver, so we
# can't try to get the _metasolver attribute from it.
avail = '*'
elif isinstance(s, pyomo.opt.solvers.UnknownSolver):
# We can get here if creating a registered
# solver failed (i.e., an exception was raised
# in __init__)
avail = ''
elif s == 'py' or (hasattr(opt, "_metasolver") and opt._metasolver):
# py is a metasolver, but since we don't specify a subsolver
# for this test, opt is actually an UnknownSolver, so we
# can't try to get the _metasolver attribute from it.
# Also, default to False if the attribute isn't implemented
elif getattr(opt, "_metasolver", False):
# Note: default to False if the attribute isn't implemented
avail = '*'
else:
avail = ''
Expand Down

0 comments on commit 7ae66e3

Please sign in to comment.