bluepy.btle.btle异常:无法执行管理命令“scannend”

2024-10-01 09:16:08 发布

您现在位置:Python中文网/ 问答频道 /正文

回溯(最近一次呼叫):

devices = scanner.scan(arg.timeout)
self._mgmtCmd(self._cmd()+"end")

Failed to execute mgmt cmd '%s'" % (cmd)) bluepy.btle.BTLEException: Failed to execute mgmt cmd 'scanend'


Tags: toselfcmdexecutescantimeoutargend
1条回答
网友
1楼 · 发布于 2024-10-01 09:16:08

这里有一个“修复”,它似乎是后续调用“bluepyhelper”之间的竞争条件。。在

diff  git a/bluepy/btle.py b/bluepy/btle.py
index ec950e1..65e6a78 100755
 - a/bluepy/btle.py
+++ b/bluepy/btle.py
@@ -218,6 +218,7 @@ class BluepyHelper:
             self._helper.stdin.write("quit\n")
             self._helper.stdin.flush()
             self._helper.wait()
+            time.sleep(0.1)
             self._helper = None
         if self._stderr is not None:
             self._stderr.close()

https://github.com/IanHarvey/bluepy/issues/150

相关问题 更多 >