I\'m trying to use socket.AF_BLUETOOTH as explained here: https://docs.python.org/3.3/library/socket.html
I have Python 3.3.5 :: Anaconda 2.1.0 (x86_64) on Mac OS X
PF_BLUETOOTH is an protocol family implemented by Linux’s bluetooth module (from BlueZ). On Linux, you create a L2CAP socket and use socket syscalls to communicate with the device (connect, bind, read, write), and the addresses have address family AF_BLUETOOTH. But this is a Linux-only socket type.
On the Mac, you need to use the CoreBluetooth API (which uses XPC messages to the blued daemon) instead to communicate to a Bluetooth LE device.
I’m not aware of a Python wrapper for CoreBluetooth on OS X, but if you want to see how it might look see the node.js libraries bleno or noble. Actually these libraries use the internal XPC messages which might not be too stable instead of the public API.