Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python bluetooth module lightblue doesn't work on mac osx 10.8

I'm trying to install python bluetooth module 'lightblue'.I intalled it using macports.When I import the module it is resulting in a bunch of errors.

>> import lightblue
2012-12-21 07:04:13.874 Python[4062:f07] PyObjCPointer created: at 0x7fff788af900 of type {__CFBoolean=}
2012-12-21 07:04:13.875 Python[4062:f07] PyObjCPointer created: at 0x7fff788af8f0 of type {__CFBoolean=}
2012-12-21 07:04:13.876 Python[4062:f07] PyObjCPointer created: at 0x7fff788af910 of type {__CFNumber=}
2012-12-21 07:04:13.876 Python[4062:f07] PyObjCPointer created: at 0x7fff788af928 of type {__CFNumber=}
2012-12-21 07:04:13.876 Python[4062:f07] PyObjCPointer created: at 0x7fff788af940 of type {__CFNumber=}
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lightblue/__init__.py", line 160, in <module>
    from _lightblue import *
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lightblue/_lightblue.py", line 28, in <module>
    import _LightAquaBlue
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lightblue/_LightAquaBlue.py", line 32, in <module>
    _FRAMEWORK_PATH)
ImportError: Cannot load LightAquaBlue framework, not found at/opt/local/Library/Frameworks/LightAquaBlue.framework

Please help me out to install this module.I didn't find many other bluetooth programming modules.pybluez doesn't have a mac version

like image 471
tez Avatar asked Dec 21 '12 01:12

tez


2 Answers

This version worked successfully for me on Mountain Lion.

like image 160
gjb Avatar answered Oct 12 '22 08:10

gjb


I'm not sure if this applies directly to the original problem or not…

Executive summary: use "sudo" and pay attention to the installer error messages.

I tried to install lightblue-0.4 on my Mac running Xcode 5.0.2

From suggestions I found in various places, I changed the last line of setup.py to this:

    os.system("xcodebuild install -target LightAquaBlue -configuration Release DSTROOT=/ INSTALL_PATH=/Library/Frameworks DEPLOYMENT_LOCATION=YES")

I changed other lines in setup.py to these:

packages=["lightblue","LightAquaBlue"],
package_dir={"lightblue":getpackagedir(), "LightAquaBlue":"%s/LightAquaBlue" % getpackagedir()},
package_data={"lightblue":[ ], "LightAquaBlue":["LightAquaBlue.bridgesupport"]},

I had to change the Build Settings in Xcode for LightAquaBlue Base SDK to OS X 10.9 (it was looking for 10.4u -- does the "u" = "and up"? I wasn't using sudo when I got the error messages in Xcode)

I got chown permission errors running the install until I used "sudo python setup.py install"

Finally (sigh), I had to copy the LightAquaBlue alias in the Macintosh HD/Libraries/LightAquaBlue.framework folder and paste it in the Macintosh HD/Libraries/LightAquaBlue.framework/Versions/A folder

After all that I got:

** INSTALL SUCCEEDED **

This will result in a bunch of object files in this folder:

lightblue-0.4/src/mac/LightAquaBlue/build/LightAquaBlue.build/Release/LightAquaBlue.build/Objects-normal/x86_64

like image 33
Cliff Harris Avatar answered Oct 12 '22 09:10

Cliff Harris