title: Python: Getting a traceback from a multiprocessing.Process
body: <p>I am trying to get hold of a traceback object from a multiprocessing.Process.
  Unfortunately passing the exception info through a pipe does not work because traceback objects can not be pickled:</p>
  
  <pre><code>def foo(pipe_to_parent):
      try:
          raise Exception('xxx')
      except:
          pipe_to_parent.send(sys.exc_info())
  
  to_child, to_self = multiprocessing.Pipe()
  process = multiprocessing.Process(target = foo, args = (to_self,))
  process.start()
  exc_info = to_child.recv()
  process.join()
  print traceback.format_exception(*exc_info)
  to_child.close()
  to_self.close()
  </code></pre>
  
  <p>Traceback:</p>
  
  <pre><code>Traceback (most recent call last):
    File "/usr/lib/python2.6/multiprocessing/process.py", line 231, in _bootstrap
      self.run()
    File "/usr/lib/python2.6/multiprocessing/process.py", line 88, in run
      self._target(*self._args, **self._kwargs)
    File "foo", line 7, in foo
      to_parent.send(sys.exc_info())
  PicklingError: Can't pickle &lt;type 'traceback'&gt;: attribute lookup __builtin__.traceback failed
  </code></pre>
  
  <p>Is there another way to access the exception info? I'd like to avoid passing the formatted string.</p>