我正试图通过MacOSX10.7.2上的Python连接到wiimote。
为此我想用浅蓝色。运行时:import lightbluePython会给我这个错误。

   >>> import lightblue
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lightblue/__init__.py", line 160, in <module>
    from _lightblue import *
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lightblue/_lightblue.py", line 27, in <module>
    import _IOBluetooth
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lightblue/_IOBluetooth.py", line 47, in <module>
    globals=globals())
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/objc/_bridgesupport.py", line 142, in initFrameworkWrapper
    _parseBridgeSupport(data, globals, frameworkName)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/objc/_bridgesupport.py", line 42, in _parseBridgeSupport
    objc.parseBridgeSupport(data, globals, frameworkName, *args, **kwds)
ValueError: cftype for 'IOBluetoothDeviceInquiryRef' must include gettypeid_func, tollfree or both

我在这里发现了一个类似的问题:http://python.6.n6.nabble.com/Python-bridgesupport-issue-on-Lion-td2161049.html#a32196961但是答案对我没有多大帮助,因为在我看来它已经在使用lightblue的文件。有什么建议吗?

最佳答案

似乎是苹果脚本的一个缺陷。您可以通过手工编辑生成的文件来消除错误。
打开gen_bridge_metadata并删除以/System/Library/Frameworks/IOBluetooth.framework/Versions/Current/Resources/BridgeSupport/IOBluetooth.bridgesupport开头的行。

10-05 23:32