title: Try/Except in a loop
body: <p>I am having difficulties with raising exceptions, for example:</p>
  
  <pre><code>import csv
  
  o = open('/home/foo/dummy.csv', 'r') # Empty file!
  reader = csv.reader(o, delimiter=';')
  reader = list(reader)
  
  try:
      for line in reader:
          print line[999] # Should raise index out of range!
  except Exception, e:
      print e
  </code></pre>
  
  <p>Basically csv.reader reads empty file, is converted to an empty list, and code above should print IndexError. But it does not.
  Code below however raises perfectly:</p>
  
  <pre><code>print reader[0][999]
  
  Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  IndexError: list index out of range
  </code></pre>
  
  <p>Am I doing something wrong?</p>