Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PyBluez 'module object has no attribute 'discover_devices'

I'm fairly new to python and I'm trying to get Pybluez to work for me.

Here is what happens when i try to discover bluetooth devises.

import bluetooth
nearby_devices = bluetooth.discover_devices()

Traceback (most recent call last):
   File "<stdin>",line1,in <module>
AttributeError: 'module' object has no attribute 'discover_devices'

I'm on windows 8.1, python 2.7.10, pybluez 0.21

like image 521
John Daly Avatar asked Jul 19 '15 17:07

John Daly


1 Answers

I had the same problem, I did the mistake of naming my program file bluetooth.py , which confused python for the package resolution, you should look out for this silly mistake if this is the case .

If this is not the case then try to put your file in the directory where your bluetooth directory (in my case, C:\Python27\Lib\site-packages) is located and then run it from there, it worked for me.

like image 90
vivkv Avatar answered Oct 05 '22 03:10

vivkv