2

我正在为 OS X 10.8 使用 Nickolay Yegorov 的 LightBlue 端口。导入lightblue模块后,我立即收到以下错误:

Traceback (most recent call last):
  File "commander.py", line 3, in <module>
    import lightblue
  File "/usr/local/lib/python2.7/site-packages/lightblue/__init__.py", line 160, in <module>
    from _lightblue import *
  File "/usr/local/lib/python2.7/site-packages/lightblue/_lightblue.py", line 397, in <module>
    class _AsyncDeviceInquiry(Foundation.NSObject):
TypeError: Error when calling the metaclass bases
    class _AsyncDeviceInquiry does not correctly implement protocol IOBluetoothDeviceInquiryDelegate: the signature for method deviceInquiryComplete:error:aborted: is v@:@iB instead of v@:@iZ

似乎可能存在版本不匹配。是否有解决此问题的已知方法?

4

1 回答 1

6

src/mac/_lightblue.pyYegorov 的 repo中打开源文件。查找第 467 行(如下所示):

deviceInquiryComplete_error_aborted_ = objc.selector(
    deviceInquiryComplete_error_aborted_, signature="v@:@iB")

将字符串更改v@:@iBv@:@iZ. 从此来源重新安装 LightBlue:

cd <lightblue_root> && sudo python setup.py install

这应该可以解决签名错误。

二进制

dlamblin请求了具有此修复程序的二进制文件。这是我的LightAquaBlue.framework,为 OS X 10.8.2 和 Python 2.7.4(放入/Library/Frameworks)构建的。

于 2013-04-11T04:01:06.327 回答