import bluetooth
print "performing inquiry..."
nearby_devices = bluetooth.discover_devices(lookup_names = True)
print "found %d devices" % len(nearby_devices)
for addr, name in nearby_devices:
print " %s - %s" % (addr, name)
this will print the number of devices , address and name . this can be used as test script for a variety for reasons .
Hi i'm trying to run the basic inquiry.py on my raspberry but i run in this issue.. I tried with 2 bluetooth dongle and they work if i do sudo hcitool scan
ReplyDeleteThis is the output i get when running inquiry.py
pi@raspberrypi ~ $ sudo python inquiry.py
performing inquiry...
Traceback (most recent call last):
File "inquiry.py", line 12, in
nearby_devices = bluetooth.discover_devices(lookup_names = True)
File "/usr/lib/python2.7/dist-packages/bluetooth/bluez.py", line 22, in discover_devices
raise BluetoothError ("error communicating with local "
bluetooth.btcommon.BluetoothError: error communicating with local bluetooth adapter