How to solve Pybluez OSerror
How to solve Pybluez OSerror
I would like to connect a Lego Mindstorms NXT using pybleuz to my labtop.
But when I search for the Mindstorms I get the following error:
import bluetooth
print("performing inquiry...")
nearby_devices = bluetooth.discover_devices(
duration=8, lookup_names=True, flush_cache=True, lookup_class=False)
print("found %d devices" % len(nearby_devices))
for addr, name in nearby_devices:
try:
print(" %s - %s" % (addr, name))
except UnicodeEncodeError:
print(" %s - %s" % (addr, name.encode('utf-8', 'replace')))
I get the error:
OSError Traceback (most recent call last)
<ipython-input-8-bcb3970d611c> in <module>()
4
5 nearby_devices = bluetooth.discover_devices(
----> 6 duration=8, lookup_names=True, flush_cache=True, lookup_class=False)
7
8 print("found %d devices" % len(nearby_devices))
/usr/local/lib/python2.7/dist-packages/bluetooth/bluez.pyc in discover_devices(duration, flush_cache, lookup_names, lookup_class, device_id)
24 lookup_class=False, device_id=-1):
25 if device_id == -1:
---> 26 device_id = _bt.hci_get_route()
27
28 sock = _gethcisock (device_id)
OSError: [Errno 97] Address family not supported by protocol
Can anyone please help me ?
@ack Have a look now please
– james
Jun 29 at 9:02
did you mix python version 2.x and 3.x?
– ack
Jun 29 at 9:25
@ack I thought that I was using python 2.x all the time... how do you come to that conclusion ?
– james
2 days ago
print "this is python 2.x" vs. print("this is python 3.x")
– ack
2 days ago
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
downvoted for inserting screenshots - hard to read and no copy/paste possible
– ack
Jun 29 at 8:54