title: Permission denied - numpy.loadtxt?
body: <p>I have a python script which polls a folder to see if a new file is added, and when a new file is added, it loads the text file into numpy.</p>
  
  <pre><code>before = dict([(f, None) for f in os.listdir('.')])
  while 1:
      #time.sleep(10)
      after = dict([(f, None) for f in os.listdir('.')])
      added = [f for f in after if f not in before]
  
      if added:
          print added[0]
          try:
              raw = numpy.loadtxt(added[0])
          except IOError:
              print "----- Error"
              core.wait(0.1)
              raw = numpy.loadtxt(added[0])
  </code></pre>
  
  <p>When I don't try catching the exception, I get an error in reading the file - "Permission denied". I am a Windows administrator, so this should not be an issue. It also only happens on some files, so I think the script might be trying to open the file before it is fully written. Is there any way to get rid of this error?</p>