title: Close failed in file object destructor [Errno 5]
body: <p>I have an <code>IOError</code> happening in a code that otherwise works except in this instance. My complete Traceback is,</p>
  
  <pre><code>Traceback (most recent call last):
    File "Utt_test.py", line 962, in &lt;module&gt;
  IOError: [Errno 5] Input/output error: '/SAH/SAH5/jimunoz/DUSTYlib2/models_Y400_1499K/COMPACTs3200_SiW_g+1.5_m1.0_t02_st_z+0.0
  close failed in file object destructor:
  IOError: [Errno 5] Input/output error
  close failed in file object destructor:
  IOError: [Errno 5] Input/output error
  </code></pre>
  
  <p>Here's the section of the code that it is giving the error in,</p>
  
  <pre><code>  #print 'Begin outer loop: Accessing the full DUSTY Models through the .tbl'
    for i in range(BestX):
     Tin=model[BestFitsModel[0][i]][2]
     Tau2=np.append(Tau2,model[BestFitsModel[0][i]][6])
     Dir=model[BestFitsModel[0][i]][0]
     Dir=Dir.replace('inp','out',1) ##replaces inp file-name extension with out, opens up correct .out file
  
     with open(Dir.replace('inp','out',1),'rb') as T: #This is line 962
      Tau = [line.split() for line in T if line.strip()]
  </code></pre>
  
  <p>(second to last line of above code block)</p>
  
  <p>In short the entirety of the code compares observed stellar data to theoretical models. One of the input parameters asks for a least-squares threshold (if the models are under the threshold it prints that info to a file). The code has been working great so far, but I decided to run a threshold at a larger value than normal, left for the night, and came back to this. The larger the threshold value, the greater number of models it needs to search for and print to a file. I was thinking (probably incorrectly) that the time duration of this action has something to do with this. But otherwise I don't know what to make of it.</p>
  
  <p>It's very strange to me because the program works fine with smaller values. What's going on?</p>
  
  <p><strong>EDIT:</strong> (after some research)</p>
  
  <p>So I ran <code>dmesg</code> to see if the what the issue might be and I got this in return,</p>
  
  <pre><code>...
  [3755345.325006] nfs: server pa5a not responding, timed out
  [3755345.625009] nfs: server pa5a not responding, timed out
  [3781101.914024] nfs: server pa5a not responding, timed out
  [3781771.727017] nfs: server pa5a not responding, timed out
  ...
  </code></pre>
  
  <p>Realizing that <code>nfs</code> means 'network file server' (had to look that up too), I'm beginning to piece together that if the program takes to long the server will 'kick me off' (probably not the most precise language, but I'm just trying to understand it). </p>
  
  <p>Is there a way to change some configuration settings to prevent this from happening? Assuming I <em>have to</em> work on the server.</p>