[英]Python: Can't scan for the info needed to connect to a bluetooth device with PyBluez, even though the device is detected
I am using the PyBluez library to try to connect my computer to a bluetooth speaker.我正在使用 PyBluez 库尝试将我的计算机连接到蓝牙扬声器。 I am running windows 10.
我正在运行 windows 10。
When I use the discover_devices function, my speaker shows up just fine:当我使用 discover_devices function 时,我的扬声器显示正常:
import bluetooth as bt
devices = bt.discover_devices(10, flush_cache=True, lookup_names=True, lookup_class=True)
for d in devices:
print d
output: output:
('BB:B8:6D:D2:C1:6C', u'OontZ Angle 3 16C', 2360324) // this is my speaker
However, when I try to get information such as the port needed to connect to the device, it doesn't return anything at all:但是,当我尝试获取连接到设备所需的端口等信息时,它根本不返回任何内容:
devices = bt.discover_devices(10, flush_cache=True, lookup_names=True, lookup_class=True)
for d in devices:
print d
addr = d[0]
print bt.find_service(address=addr) // this function returns info such as port, protocol, etc about devices
Output: Output:
('BB:B8:6D:D2:C1:6C', u'OontZ Angle 3 16C', 2360324) // this is a speaker
[] // this should be a list of information about the device
Does anyone know what would cause this to happen?有谁知道什么会导致这种情况发生? Here's some more information:
以下是更多信息:
File "C:\Python27\lib\site-packages\bluetooth\msbt.py", line 243, in find_service
文件“C:\Python27\lib\site-packages\bluetooth\msbt.py”,第 243 行,在 find_service
dresults = bt.find_service (addr, uuidstr)
dresults = bt.find_service (addr, uuidstr)
IOError: A
IO错误:一个
Thank you.谢谢你。
you might need to install another version of Python, 3.5.4, and then download the wheel file specifically for this version of python.你可能需要安装另一个版本的Python,3.5.4,然后下载这个版本python专用的wheel文件。
wheel file URL and then use pip to install it: pip install PyBluez‑0.22‑cp35‑none‑win_amd64.whl
wheel 文件URL然后使用 pip 安装它:
pip install PyBluez‑0.22‑cp35‑none‑win_amd64.whl
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.