PyBluez '模块对象没有属性 'discover_devices'
PyBluez 'module object has no attribute 'discover_devices'
我是 python 的新手,我正在尝试让 Pybluez 为我工作。
这是我尝试发现蓝牙设备时发生的情况。
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'
我在 windows 8.1,python 2.7.10,pybluez 0.21
我有同样的问题,我把我的程序文件命名为 bluetooth.py
的错误,这混淆了 python 包解析,如果这是案例.
如果不是这种情况,请尝试将您的文件放在您的蓝牙目录(在我的例子中,C:\Python27\Lib\site-packages
)所在的目录中,然后从那里 运行 它,它工作对我来说。
我遇到了同样的问题,因为我使用了我的文件名 bluetooth.py
。因此 python 无法理解要执行的文件。
请重命名您的文件然后它将起作用。
将文件重命名为任何其他名称,除了“bluetooth.py”
我是 python 的新手,我正在尝试让 Pybluez 为我工作。
这是我尝试发现蓝牙设备时发生的情况。
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'
我在 windows 8.1,python 2.7.10,pybluez 0.21
我有同样的问题,我把我的程序文件命名为 bluetooth.py
的错误,这混淆了 python 包解析,如果这是案例.
如果不是这种情况,请尝试将您的文件放在您的蓝牙目录(在我的例子中,C:\Python27\Lib\site-packages
)所在的目录中,然后从那里 运行 它,它工作对我来说。
我遇到了同样的问题,因为我使用了我的文件名 bluetooth.py
。因此 python 无法理解要执行的文件。
请重命名您的文件然后它将起作用。
将文件重命名为任何其他名称,除了“bluetooth.py”