如何解决Pybluez

2024-04-28 00:05:34 发布

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

我想连接一个乐高Mindstorms NXT使用pybleuz到我的labtop。 但是当我搜索Mindstorms时,我得到了以下错误:

import bluetooth

print("performing inquiry...")

nearby_devices = bluetooth.discover_devices(
        duration=8, lookup_names=True, flush_cache=True, lookup_class=False)

print("found %d devices" % len(nearby_devices))

for addr, name in nearby_devices:
    try:
        print("  %s - %s" % (addr, name))
    except UnicodeEncodeError:
        print("  %s - %s" % (addr, name.encode('utf-8', 'replace')))

我得到了一个错误:

^{pr2}$

谁能帮帮我吗?在


Tags: nameimporttrue错误lookupnxtmindstormsaddr