3

I just tried to implement bluetooth from Python in PyCharm, using PyBluez. I am stuck with this particular error. I tried to search this error but could not find it. Can anybody help ?

This is my code

>>> from bluetooth import discover_devices
>>> nearby_devices = discover_devices()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\bluetooth\msbt.py", line 15, in discover_devices
    devices = bt.discover_devices(duration=duration, flush_cache=flush_cache)
IOError: The RPC server is unavailable.
Peter Wood
  • 23,859
  • 5
  • 60
  • 99
  • I got the same error. I checked in services and the Bluetooth Support Service wasn't running (I think I disabled it long ago). I restarted it and got a different error `IOError: The handle is invalid.`. I don't have a bluetooth device nearby so I can't test that. Is your PC able to discover devices? – Peter Wood Sep 04 '15 at 05:02

1 Answers1

1

I had the same error and managed to fix it.

The Bluetooth Radio device was disabled on my laptop.

I opened Device Manager, selected the device, and enabled it.

Now my output is:

>>> from bluetooth import discover_devices
>>> discover_devices()
['2C:4A:05:96:27:01']
Peter Wood
  • 23,859
  • 5
  • 60
  • 99