我几乎搜索了整个网络(打个比方来说),试图找到一种在 Mac 上通过 Python 使用蓝牙的方法。PyBluez 不兼容,Lightblue 没有得到维护(无论如何尝试),安装了 PyObC 框架(包括蓝牙框架),并在我的 MacOS 10.10.5 的 2.7.6 和 3.6.1 环境中进行了尝试。
我经常遇到类似以下的错误:
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 …Run Code Online (Sandbox Code Playgroud)