我正在使用Nickolay Yegorov的port of LightBlue for OS X 10.8。导入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
似乎可能存在版本不匹配。是否有针对此问题的已知修复程序?
答案 0 :(得分:6)
从Yegorov's repo打开源中的文件src/mac/_lightblue.py
。找到第467行(如下所示):
deviceInquiryComplete_error_aborted_ = objc.selector(
deviceInquiryComplete_error_aborted_, signature="v@:@iB")
将字符串v@:@iB
更改为v@:@iZ
。从此来源重新安装LightBlue:
cd <lightblue_root> && sudo python setup.py install
这应解决签名错误。
dlamblin请求使用此修复程序的二进制文件。这是my LightAquaBlue.framework
,是为OS X 10.8.2和Python 2.7.4(放在/Library/Frameworks
中)而构建的。