title: Gurobi returns AttributeError error when accessing current value of a variable with .X attribute
body: <p>I have the following piece of code in my gurobi optimization where  M is a binary variable. I am accessing the value of the variable with .X attribute but when I run my code it gives me this error: </p>
  
  <p><code>AttributeError: b"Index out of range for attribute 'X'"</code></p>
  
  <p>if I remove .X attribute, the code runs without any error but it returns true for the if statement for all the elements in M variable even if the value is not "1.0". I guess it checks the existence of a value in the variable M which is True even it is "0.0". In this case, after running the code I try to run the same piece of the code (for loops) in the console and there is no such error!. </p>
  
  <pre><code>    for s in range(S)
          for t in range(T):
              for f in range(F):
                  if M[(a,t,f)].X == 1:
                      print(M[(a,t,f)].X)
  </code></pre>