Search code examples
pythonsiposx-mountain-lionpjsip

pjsua: unable to import pjsua python module


I'm getting the below error while trying to import python module pjsua. I have Mac OS 10.8.1 version. I verified the solution provided in http://www.darrensessions.com/?p=292 and the solution seemed to have fixed this issue in MacOS-10.7. Seems like this is broken again for MacOS-10.8. I did not got any errors when compiling the code. Only get the below error when importing PJSUA module.

>>> import pjsua
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pjsua.py", line 59, in <module>
    import _pjsua
ImportError: dlopen(/Library/Python/2.7/site-packages/_pjsua.so, 2): Symbol not found: _AudioOutputUnitStart
  Referenced from: /Library/Python/2.7/site-packages/_pjsua.so
  Expected in: flat namespace
 in /Library/Python/2.7/site-packages/_pjsua.so

Your help in highly appreciated. Thanks,


Solution

  • One straight-forward solution would be (purely theoretical, haven't tested):

    1. Look at http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/2011-November/013722.html
    2. See, where the patch says:

      # OS X Lion Support
      if platform.mac_ver()[0].startswith("10.7"):
      extra_link_args += ["-framework", "AudioUnit"]
      
    3. Change line

      if platform.mac_ver()[0].startswith("10.7"):
      

      to

      if platform.mac_ver()[0].startswith("10.7") or platform.mac_ver()[0].startswith("10.8"):
      
    4. Recompile

    -- edit --

    Ok, I patched it as I suggested and:

    > python ~/a.py 
    a
    > cat ~/a.py 
    import pjsua
    
    test = "a"
    print test