Skip to content

'StatusNotOk' object has no attribute 'canonical_code' #4606

Closed

Description

@mvds314

What version of OR-Tools and what language are you using?
Version: 9.12.4544
Language: Python

Which solver are you using
GLOP

What operating system and version?
Windows 11

What did you do?
Set up a problem with mathopt, selected a solver that, apparently, was not suitable for the problem.

What did you expect to see
Proper handling of the exception

What did you see instead?
An additional error raised on on handling of the exception:

'StatusNotOk' object has no attribute 'canonical_code'

model = mathopt.Model(name="getting_started_lp")
x = model.add_variable(lb=-1.0, ub=1.5, name="x")
y = model.add_variable(lb=0.0, ub=1.0, name="y")
z = model.add_binary_variable(name="z")
model.add_linear_constraint(x + y + z <= 1.5)
model.maximize(x + 2 * y + z)
params = mathopt.SolveParameters(enable_output=True)

result = mathopt.solve(model, mathopt.SolverType.GLOP, params=params)
if result.termination.reason != mathopt.TerminationReason.OPTIMAL:
    raise RuntimeError(f"model failed to solve: {result.termination}")

Activity

  1. lperron commented on Mar 28, 2025

    @lperron
    Collaborator

    known bug in pybind11_abseil.

  2. lperron commented on Mar 29, 2025

    @lperron
    Collaborator

    StatusNotOk is a absl::Status status converted to exception in pybind11_abseil exception:

    • it works on linux
    • it simili works on mac but it is not the right parent class
    • it does not work on windows at all
  3. self-assigned this
    on Mar 31, 2025
  4. Mizux commented on Mar 31, 2025

    @Mizux
    Collaborator
  5. added this to the v9.13 milestone on Mar 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions