title: python: piping loop error into list without interrupting loop
body: <p>I am extracting information from a large number of files using a loop iterating through a file list. Some of the files are corrupted and the operation cannot be done. this causes a 'PackageNotFoundError:'</p>
  <p>The error is to be expected.
  Question: How can I log the index of the bad file and the loop to continue?</p>
  <p>My code</p>
  <pre><code>for c in targets_in_dir:
  
      document = Document(c)
      table = document.tables[2]
  
      data = []
  
      keys = None
      for i, row in enumerate(table.rows):
          text = (cell.text for cell in row.cells)
  
          if i == 0:
              keys = tuple(text)
              continue
          row_data = dict(zip(keys, text))
          data.append(row_data)
      
     
  </code></pre>