Error in Reading Model: Python Jupyter
AnsweredHi,
I am unable to read a model file with "afiro.mps" following example 1 of the Python I Webinar even though this .mps file is already in the data folder. Below is the complete error message. could you please help me out?
Unable to open file 'afiro.mps' for input
---------------------------------------------------------------------------
GurobiError Traceback (most recent call last)
<ipython-input-15-56eb22f5bc96> in <module>
----> 1 model = read("afiro.mps")
src\gurobipy\gurobi.pxi in gurobipy.read()
src\gurobipy\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,
Could you please provide more information? In particular, could you show the code you are using to read the \(\texttt{afiro}\) model? Are you sure that you are in the correct folder? Could you try to provide the full path to the \(\texttt{afiro}\) model? On a Mac, this would be
/Library/gurobi912/mac64/examples/data/afiro.mps
Best regards,
Jaromił0 -
I have entered this code to read the file, but its not working
model = read("C:\gurobi912\win64\examples\data\afiro.mps")
0 -
Could you please post your whole code snippet? Can you please double check that the path is correct and the file \(\texttt{afiro.mps}\) is indeed in the desired location?
From the command line, can you execute
gurobi_cl C:\gurobi912\win64\examples\data\afiro.mps
Are you using the \(\texttt{gurobi.bat}\) shell?
Are you able to execute the following Python code?
import gurobipy as gp
model = gp.Model("test")0 -
0 -
and yes, I am also able to execute the code from the command line as you asked in the above comment
gurobi_cl C:\gurobi912\win64\examples\data\afiro.mps
0 -
\(\texttt{\a}\) is the escape sequence for the ASCII bell. In your code you should use \(\texttt{\\\\}\) instead of \(\texttt{\\}\) when specifying paths.
model = read("C:\\gurobi912\\win64\\examples\\data\\afiro.mps")Best regards,
Jaromił1 -
Yeah, that was the problem. Now it works.
Thanks a lot for your quick responses, Jaromil :)
0
Post is closed for comments.
Comments
8 comments