title: How to find out what cannot be serialized?
body: <p>When writing a program using <code>multiprocessing</code> and classes I sometimes stumble upon the exception</p>
  
  <pre><code>TypeError: cannot serialize '_io.TextIOWrapper' object
  </code></pre>
  
  <p>(the object can be different).</p>
  
  <p>I understand why this is so and there are <a href="https://stackoverflow.com/a/26249586/903011">specific examples on how to fix specific cases</a>.</p>
  
  <p>Is there a straightforward way to tell which variable is causing the issue? This is not (at least for me) visible in the stack</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:/Users/yop/dev/checkssllabs/checkssllabs.py", line 62, in &lt;module&gt;
      pool.map(s.analyse, sites)
    File "C:\Python34\lib\multiprocessing\pool.py", line 260, in map
      return self._map_async(func, iterable, mapstar, chunksize).get()
    File "C:\Python34\lib\multiprocessing\pool.py", line 599, in get
      raise self._value
    File "C:\Python34\lib\multiprocessing\pool.py", line 383, in _handle_tasks
      put(task)
    File "C:\Python34\lib\multiprocessing\connection.py", line 206, in send
      self._send_bytes(ForkingPickler.dumps(obj))
    File "C:\Python34\lib\multiprocessing\reduction.py", line 50, in dumps
      cls(buf, protocol).dump(obj)
  TypeError: cannot serialize '_io.TextIOWrapper' object
  </code></pre>
  
  <p>I will not be useful to post the (small) wall of code which generated this because I am looking for a generic way to hunt down these variables. Is the only way to analyze all of the imported modules and your own code, asking for every variable the question "is it serializable"?</p>
  
  <p><sup><sup>To be totally frank I found, by miracle, the variable which was causing my specific problem but a generic approach would be very useful</sup></sup></p>