lightblue Python模块无法在mac上运行

时间:2012-01-25 05:49:33

标签: python bluetooth

我正在尝试通过Python在mac osx 10.7.2上连接到wiimote。

为此,我试图使用浅蓝色。运行时:import lightblue Python给了我这个错误。

   >>> 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的文件了。有什么建议吗?

1 个答案:

答案 0 :(得分:0)

似乎是Apple的gen_bridge_metadata脚本的错误。您可以通过手动编辑生成的文件来消除错误。

打开/System/Library/Frameworks/IOBluetooth.framework/Versions/Current/Resources/BridgeSupport/IOBluetooth.bridgesupport并删除以<cftype开头的行。

相关问题