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

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")

GurobiError: Unable to read model


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.