title: cPickle.PicklingError: Can't pickle <type 'instancemethod'>: attribute lookup __builtin__.instancemethod failed
body: <p>I've looked at <a href="https://stackoverflow.com/questions/1816958/cant-pickle-type-instancemethod-when-using-pythons-multiprocessing-pool-ma">Can&#39;t pickle &lt;type &#39;instancemethod&#39;&gt; when using python&#39;s multiprocessing Pool.map()</a> which describes a similar problem, but I'm not using a class' method.</p>
  
  <p>What I'm trying to do is update several MySQL servers concurrently.  I have:</p>
  
  <pre><code>def do_update(cur, update, output_fh):
      try:
          cur.execute(update)
      except MySQLdb.MySQLError, e:
          output_fh.write("failed on:{}\n".format(update))
          raise MySQLdb.MySQLError(e)
  </code></pre>
  
  <p>to perform the actual update.  I've attempted two different approaches to use a multiprocessing Pool to update in parallel and both result in the error message in the subject.</p>
  
  <h1>1:</h1>
  
  <pre><code>def update_score_wrapper(args):
      do_update(*args)
  pool = multiprocessing.Pool(processes=3)
  pool.map(update_score_wrapper, ((cur2, update, output_fh),
           (cur3, update, output_fh), (cur4, update, output_fh)))
  </code></pre>
  
  <p>where cur2, cur3, and cur4 are MySQLdb cursors, update is the update statement, and output_fh is a file handle to a shared log.</p>
  
  <h1>2:</h1>
  
  <pre><code>partial_score = functools.partial(
      do_update, update=update, output_fh=output_fh)
  pool = multiprocessing.Pool(processes=3)
  pool.map(partial_score, (cur2, cur3, cur4))
  </code></pre>
  
  <p>Anyone able to tell me what's going wrong here?  My suspicion is that perhaps the cursor or file handle is not picklable?  If so, are there any alternative approaches to try?</p>