使用 pybluez 进行 python 蓝牙发现

标签 python bluetooth

我正在尝试运行这个脚本:

import PyOBEX
import bluetooth

print "performing inquiry..."

nearby_devices = bluetooth.discover_devices(lookup_names = True)

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

for name, addr in nearby_devices:
    print " %s - %s" % (addr, name)

但是我在终端中收到未实现的错误。这是我得到的输出:

Last login: Sat Dec  4 20:59:06 on ttys001
You have mail.
cd '/Users/riceje7/School/NMD 430/' && '/usr/bin/pythonw'  '/Users/riceje7/School/NMD 430/BluetoohLocator.py'  && echo Exit status: $? && exit 1
Joseph-Rices-MacBook-Pro:~ riceje7$ cd '/Users/riceje7/School/NMD 430/' && '/usr/bin/pythonw'  '/Users/riceje7/School/NMD 430/BluetoohLocator.py'  && echo Exit status: $? && exit 1
Traceback (most recent call last):
File "/Users/riceje7/School/NMD 430/BluetoohLocator.py", line 2, in <module>
import bluetooth
File "/Library/Python/2.6/site-packages/bluetooth/__init__.py", line 36, in <module>
from osx import *
File "/Library/Python/2.6/site-packages/bluetooth/osx.py", line 3, in <module>
raise NotImplementedError
NotImplementedError

谁能帮我弄清楚发生了什么以及为什么脚本无法正常运行?

最佳答案

source code for init.py

elif sys.platform == "darwin":
    from osx import *

还有source code for osx.py

from btcommon import *

raise NotImplementedError

这与仅提及 Linux 和 Windows 实现的网页一致。您可能需要向开发人员咨询其路线图上有关 OSX 支持的信息。

关于使用 pybluez 进行 python 蓝牙发现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4359292/

相关文章:

swift - 核心蓝牙状态恢复只触发一次

python - 如何在 Django 中将 select_related 与 GenericForeignKey 一起使用?

python - 从 Pandas DataFrame 中提取日期

java - 如何将安装在移动设备上的 J2me Midlet 连接到 Java 应用程序?

iphone - 使用 Core Bluetooth 在后台获取蓝牙 LE 外设广告

ios - iOS 的 BLE 支持

android - 使用自定义数据包的 BLE 广告

python - 如何将自定义 Django 用户模型注册到管理页面?

Python多处理进程不会终止

python - 如何对数字列表求和?