【发布时间】:2017-11-06 13:19:43
【问题描述】:
我几乎搜索了整个网络(比喻地说),试图找到一种在 Mac 上通过 Python 使用蓝牙的方法。 PyBluez 不兼容,Lightblue 没有得到维护(无论如何都尝试过),安装了 PyObC 框架(包括蓝牙框架),并尝试在我的 2.7.6 和 3.6.1 环境中使用 MacOS 10.10.5。
我经常遇到类似以下的错误:
Traceback (most recent call last):
File "/Users/***/PycharmProjects/Bluey/main.py", line 1, in <module>
import bluetooth
File "build/bdist.macosx-10.10-intel/egg/bluetooth/__init__.py", line 47, in <module>
File "build/bdist.macosx-10.10-intel/egg/bluetooth/osx.py", line 1, in <module>
File "build/bdist.macosx-10.10-intel/egg/lightblue/__init__.py", line 160, in <module>
File "build/bdist.macosx-10.10-intel/egg/lightblue/_lightblue.py", line 31, in <module>
File "build/bdist.macosx-10.10-intel/egg/lightblue/_macutil.py", line 169, in <module>
objc.BadPrototypeError: Objective-C expects 1 arguments, Python argument has 2 arguments for <unbound selector sleep of BBCocoaSleeper at 0x103cdc030>
Process finished with exit code 1
我还尝试为这两种环境重新安装所有上述模块。
我只是希望能够在一个项目中使用蓝牙而无需更改操作系统。我确定我错过了一些东西,因为我怀疑没有人在 Mac 上使用 Python 的蓝牙代码。如果存在固有的兼容性问题,是否还有我尚未发现的其他模块?
【问题讨论】:
-
macOS 上没有完整的 BLE 库。
标签: python macos bluetooth python-module