xavierd / clang_complete

Vim plugin that use clang for completing C/C++ code.
http://www.vim.org/scripts/script.php?script_id=3302
1.96k stars 308 forks source link

Python error after installation #574

Open luisvgs opened 4 years ago

luisvgs commented 4 years ago

Hi, I'm trying to install the plugin, but after setting up the clang_library_path, neovim outputs the following error:

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/home/luis/.vim/bundle/clang_complete/plugin/libclang.py", line 493, in run
    self.timer)
  File "/home/luis/.vim/bundle/clang_complete/plugin/libclang.py", line 212, in getCurrentTranslationUnit
    tu.reparse([currentFile])
  File "/home/luis/.vim/bundle/clang_complete/plugin/clang/cindex.py", line 2204, in reparse
    value = value.read()
AttributeError: 'unicode' object has no attribute 'read'

Am I missing any additional step after the installation? I would appreciate any guidance. Thanks in advance.

ImanolGB commented 4 years ago

Just in case it helps you my clumsy fix, my installation didn't like python2 neither, so I manually edited the clang_complete.vim file to force python3.

" if has('python')
"   let s:py_cmd = 'python'
"   let s:pyfile_cmd = 'pyfile'
" elseif has('python3')
let s:py_cmd = 'python3'
let s:pyfile_cmd = 'py3file'
" endif

From your error I guess your file to edit is in /home/luis/.vim/bundle/clang_complete/plugin/clang_complete.vim

almucantar commented 4 years ago

Have encountered the same. Any guess to fix?

xaizek commented 4 years ago

I would guess #581 should fix this.

bdebyl commented 3 years ago

@xaizek it should fix it, same issue I had.