Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YouCompleteMe runs python error #831

Closed
frankiejun opened this issue Feb 14, 2014 · 2 comments
Closed

YouCompleteMe runs python error #831

frankiejun opened this issue Feb 14, 2014 · 2 comments

Comments

@frankiejun
Copy link

first I install vim with python 2.x support, then install YouCompleteMe and install Clang 3.4 in /home/xjf/.vim/bundle/YouCompleteMe/,
use ./install.sh --clang-completer.
all these are successful. but YouCompleteMe can't work. when use YcmCompleter GoToDeclaration command, it' shows error as following:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/xjf/.vim/bundle/YouCompleteMe/autoload/../python/ycm/youcompleteme.py", line 239, in OnBufferUnload
    { 'unloaded_buffer': deleted_buffer_file } )
  File "/home/xjf/.vim/bundle/YouCompleteMe/autoload/../python/ycm/client/event_notification.py", line 71, in SendEventNotificationA
sync
    event.Start()
  File "/home/xjf/.vim/bundle/YouCompleteMe/autoload/../python/ycm/client/event_notification.py", line 41, in Start
    'event_notification' )
  File "/home/xjf/.vim/bundle/YouCompleteMe/autoload/../python/ycm/client/base_request.py", line 77, in PostDataToHandlerAsync
    return BaseRequest._TalkToHandlerAsync( data, handler, 'POST', timeout )
  File "/home/xjf/.vim/bundle/YouCompleteMe/autoload/../python/ycm/client/base_request.py", line 113, in _TalkToHandlerAsync
    return SendRequest( data, handler, method, timeout )
  File "/home/xjf/.vim/bundle/YouCompleteMe/autoload/../python/ycm/client/base_request.py", line 92, in SendRequest
    data = json.dumps( data ),
  File "/usr/lib64/python2.7/json/__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  File "/usr/lib64/python2.7/json/encoder.py", line 201, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib64/python2.7/json/encoder.py", line 264, in iterencode
    return _iterencode(o, 0)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xb2 in position 1524: invalid start byte

when exits vim, it always occurs error :

Error detected while processing function <SNR>61_OnBufferUnload:
line    5:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/xjf/.vim/bundle/YouCompleteMe/autoload/../python/ycm/youcompleteme.py", line 239, in OnBufferUnload
    { 'unloaded_buffer': deleted_buffer_file } )
  File "/home/xjf/.vim/bundle/YouCompleteMe/autoload/../python/ycm/client/event_notification.py", line 71, in SendEventNotificationA
sync
    event.Start()
  File "/home/xjf/.vim/bundle/YouCompleteMe/autoload/../python/ycm/client/event_notification.py", line 41, in Start
    'event_notification' )
  File "/home/xjf/.vim/bundle/YouCompleteMe/autoload/../python/ycm/client/base_request.py", line 77, in PostDataToHandlerAsync
    return BaseRequest._TalkToHandlerAsync( data, handler, 'POST', timeout )
  File "/home/xjf/.vim/bundle/YouCompleteMe/autoload/../python/ycm/client/base_request.py", line 113, in _TalkToHandlerAsync
    return SendRequest( data, handler, method, timeout )
  File "/home/xjf/.vim/bundle/YouCompleteMe/autoload/../python/ycm/client/base_request.py", line 92, in SendRequest
    data = json.dumps( data ),
  File "/usr/lib64/python2.7/json/__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  File "/usr/lib64/python2.7/json/encoder.py", line 201, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib64/python2.7/json/encoder.py", line 264, in iterencode
    return _iterencode(o, 0)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xb2 in position 1524: invalid start byte

my system is

Linux fedora16 3.6.10-2.fc16.x86_64 #1 SMP Tue Dec 11 18:55:03 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

vim7.4

both python2.7.3 and python3.3 in /usr/bin
[xjf@fedora16:/usr/bin/]ls -l python*
lrwxrwxrwx 1 root root       18  2月 14 18:38 python -> /usr/bin/python2.7
lrwxrwxrwx 1 root root        9  5月 27 2012 python2 -> python2.7
-rwxr-xr-x 1 root root     9496  4月 14 2012 python2.7
-rwxr-xr-x 1 root root     1785  4月 14 2012 python2.7-config
-rwxr-xr-x 1 root root 10156987 11月 18 18:03 python3.3
lrwxrwxrwx 1 root root       14  5月 27 2012 python-config -> python2-config

I don't know how to fix this issue.

@Valloric
Copy link
Member

Looks like a Unicode encoding issue. Does your buffer contain any non-ASCII chars (shouldn't be a problem, but might...)? Does the filepath to file you are editing contain non-ASCII chars (again, shouldn't be a problem)?

Please try to provide a minimal test case that can repro this issue.

@Valloric
Copy link
Member

Closing as duplicate of #821.

If you can produce a test case, please add it to that issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants