<ipython-input-2-56eb22f5bc96>
AnsweredI can't find afiro.mps
Academic license - for non-commercial use only
Unable to open file 'afiro.mps' for input
---------------------------------------------------------------------------
GurobiError Traceback (most recent call last)
<ipython-input-2-56eb22f5bc96> in <module>
----> 1 model = read("afiro.mps")
gurobi.pxi in gurobipy.read()
gurobi.pxi in gurobipy.gurobi.read()
GurobiError: Unable to read model
-
Hi,
The easiest way to read a file is to give the complete path of this file. We provide a copy of afiro.mps in your Gurobi installation directory in examples/data. If you don't want to provide the complete path you should copy the file to your current working directory.
Best regards,
Sonja
0 -
Hi, I get this error, what should I do?
Unable to open file 'C:\gurobi902\win64\examples\datafiro.mps' for input
--------------------------------------------------------------------------- GurobiError Traceback (most recent call last) <ipython-input-8-61beb9e089e5> in <module> ----> 1 model = read("C:\gurobi902\win64\examples\data\afiro.mps") gurobi.pxi in gurobipy.read() gurobi.pxi in gurobipy.gurobi.read() GurobiError: Unable to read model
0 -
You are trying to read a model with
model = read("C:\gurobi902\win64\examples\data\afiro.mps")
In Python, \( \texttt{\a} \) is an escape sequence for a special ASCII character. To ensure your path is parsed correctly, try escaping the backslashes in the string with two backslashes:
model = read("C:\\gurobi902\\win64\\examples\\data\\afiro.mps")
You could alternatively use \( \texttt{os.path.join()} \) to avoid issues like this.
0
Please sign in to leave a comment.
Comments
3 comments