<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
-
Official comment
This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum. Or why not try our AI Gurobot?. -
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
Post is closed for comments.
Comments
4 comments