Ask Your Question

Revision history [back]

I see two possible problems with your code:

  • the MIPSolverException is not imported by Sage by default, so you have to import it first:

    sage: from sage.numerical.mip import MIPSolverException

  • when you write

    ....: except MIPSolverException:

you have to do something with it, like:

....:         except MIPSolverException:
....:             print 'n is not large enough

or, more simply

....:         except MIPSolverException:
....:             pass

I see two possible problems with your code:

  • the MIPSolverException is not imported by Sage by default, so you have to import it first:

     sage: from sage.numerical.mip import MIPSolverException

    MIPSolverException
  • when you write

    ....:         except MIPSolverException:

MIPSolverException:

you have to do something with it, like:

....:         except MIPSolverException:
....:             print 'n is not large enough

or, more simply

....:         except MIPSolverException:
....:             pass