【问题标题】:clang's python binding throws an exception when get_children is called当调用 get_children 时,clang 的 python 绑定会抛出异常
【发布时间】:2017-09-12 13:58:23
【问题描述】:

我正在尝试运行找到here 的示例,但它总是无法执行。经过一番调试,发现是node.get_children()引起了异常,下面是traceback:

Traceback (most recent call last):
File "_ctypes/callbacks.c", line 314, in 'calling callback function'
File "C:\Python27\lib\site-packages\clang\cindex.py", line 1383, in visitor
children.append(child)
AttributeError: 'str' object has no attribute 'append'

我在 Windows 上使用 LLVM 4.0.1,我通过 pip 安装了 clang(尝试了 clang3.5 和 clang4.0.post1)。

这是我的 LD_LIBRARY_PATH: C:\Program Files\LLVM\bin,我添加到我的 像这样的 PATH:%LD_LIBRARY_PATH%;%PYTHONPATH%;...其余路径...

我在安装 LLVM5.0 并从 github 克隆 clang 后遇到了同样的错误。

编辑:我使用的是 Python2.7,但切换到 Python 3.6.3 后一切正常。

【问题讨论】:

    标签: python parsing clang


    【解决方案1】:

    切换到 Python 3.6 解决了这个问题。

    【讨论】:

      猜你喜欢
      • 2015-04-11
      • 1970-01-01
      • 1970-01-01
      • 2021-02-07
      • 1970-01-01
      • 2011-07-12
      • 2021-11-05
      • 1970-01-01
      • 2013-05-24
      相关资源
      最近更新 更多