title: How to fail with error message "Too many open files in python"
body: <p>I created 10000 files - my default limit was " ulimit -n 1024" - I expected following script to fail with a message like "Too many files open" , but it didn't fail.  (/tmp/files has 10000 files) </p>
  
  <p>Any thoughts on where am i going wrong? </p>
  
  <pre><code>import os
  listfiles=os.listdir('/tmp/files')
  count=0
  f=''
  for file in listfiles:
          fn=f+str(count)
          fn=open(file,'w')
          fn.write('hello')
          print 'file=',file
          count=count+1
  
  print count
  </code></pre>