title: Python multiprocessing, PyAudio, and wxPython
body: <p>I have a wxPython GUI, and would like to use multiprocessing to create a separate process which uses PyAudio.  That is, I want to use PyAudio, wxPython, and the multiprocessing module, but although I can use any two of these, I can't use all three together.  Specifically, if from one file I import wx, and create a <code>multiprocessing.Process</code> which opens PyAudio, PyAudio won't open.  Here's an example:</p>
  
  <p><strong>file: A.py</strong></p>
  
  <pre><code>import wx
  import time
  use_multiprocessing = True
  if use_multiprocessing:
      from multiprocessing import Process as X
  else:
      from threading import Thread as X
  import B
  
  if __name__=="__main__":
      p = X(target=B.worker)
      p.start()
      time.sleep(5.)
      p.join()
  </code></pre>
  
  <p><strong>file: B.py</strong><br></p>
  
  <pre><code>import pyaudio
  
  def worker():
      print "11"
      feed = pyaudio.PyAudio()
      print "22"
      feed.terminate()
  </code></pre>
  
  <p>In all my tests I see <code>11</code> print, but the problem is that I don't see <code>22</code> for the program as shown.</p>
  
  <ul>
  <li>If I only comment out <code>import wx</code> I see <code>22</code> and pyaudio loads</li>
  <li>If I only set <code>use_multiprocessing=False</code> so I use threading instead, I see <code>22</code> and pyaudio loads.</li>
  <li>If I do something else in <code>worker</code>, it will run (only pyaudio doesn't run) </li>
  </ul>
  
  <p>I've tried this with Python 2.6 and 2.7; PyAudio 0.2.4, 0.2.7, and 0.2.8; and wx 3.0.0.0 and 2.8.12.1; and I'm using OSX 10.9.4</p>