title: Python multiprocessing.Pool map() "TypeError: string indices must be integers, not str"
body: <p>I am attempting to use multiprocessing.Pool to do parallel processing on a list of dictionaries.  An example is below </p>
  
  <p>(<strong>Please note</strong>: this is a toy example, my actual example will be doing cpu-intensive processing on the values in the actual dictionary)</p>
  
  <pre><code>import multiprocessing
  
  my_list = [{'letter': 'a'}, {'letter': 'b'}, {'letter': 'c'}]
  
  def process_list(list_elements):
      ret_list = []
      for my_dict in list_elements:
          ret_list.append(my_dict['letter'])
      return ret_list
  
  if __name__ == "__main__":
      pool = multiprocessing.Pool()
      letters = pool.map(process_list, my_list)
      print letters
  </code></pre>
  
  <p>If I run the code above, I get the following error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "multiprocess_fail.py", line 13, in &lt;module&gt;
      letters = pool.map(process_list, my_list)
    File "/usr/lib/python2.7/multiprocessing/pool.py", line 250, in map
      return self.map_async(func, iterable, chunksize).get()
    File "/usr/lib/python2.7/multiprocessing/pool.py", line 554, in get
      raise self._value
  TypeError: string indices must be integers, not str
  </code></pre>
  
  <p>I don't know what string indices it is referring to.  Shouldn't <code>pool.map</code> just be iterating over the items in <code>my_list</code> (i.e. the dictionaries)?  Do I have to alter how the data is being passed to the map function to get it to run?</p>