Ultisnips: Ultisnips causes python error with latest Neovim version

Created on 29 Mar 2016  路  10Comments  路  Source: SirVer/ultisnips

  • Neovim version:
NVIM 0.1.3-dev
Build type: RelWithDebInfo
Compilation: /usr/bin/x86_64-linux-gnu-gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wconversion -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2 -g -DDISABLE_LOG -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wvla -fstack-protector --param ssp-buffer-size=4 -DINCLUDE_GENERATED_DECLARATIONS -DHAVE_CONFIG_H -D_GNU_SOURCE -I/build/neovim-EtgA2h/neovim-0.1.2ubuntu1+git201603241504+2376+17~ubuntu14.04.1/build/config -I/build/neovim-EtgA2h/neovim-0.1.2ubuntu1+git201603241504+2376+17~ubuntu14.04.1/src -I/build/neovim-EtgA2h/neovim-0.1.2ubuntu1+git201603241504+2376+17~ubuntu14.04.1/.deps/usr/include -I/build/neovim-EtgA2h/neovim-0.1.2ubuntu1+git201603241504+2376+17~ubuntu14.04.1/.deps/usr/include -I/usr/include/luajit-2.0 -I/build/neovim-EtgA2h/neovim-0.1.2ubuntu1+git201603241504+2376+17~ubuntu14.04.1/.deps/usr/include -I/build/neovim-EtgA2h/neovim-0.1.2ubuntu1+git201603241504+2376+17~ubuntu14.04.1/.deps/usr/include -I/build/neovim-EtgA2h/neovim-0.1.2ubuntu1+git201603241504+2376+17~ubuntu14.04.1/.deps/usr/include -I/build/neovim-EtgA2h/neovim-0.1.2ubuntu1+git201603241504+2376+17~ubuntu14.04.1/.deps/usr/include -I/usr/include -I/build/neovim-EtgA2h/neovim-0.1.2ubuntu1+git201603241504+2376+17~ubuntu14.04.1/build/src/nvim/auto -I/build/neovim-EtgA2h/neovim-0.1.2ubuntu1+git201603241504+2376+17~ubuntu14.04.1/build/include
Compiled by buildd@lgw01-24

Optional features included (+) or not (-): +acl   +iconv    +jemalloc
For differences from Vim, see :help vim-differences

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"
  • Operating system:
    Linux 16.0-67-generic #87~14.04.1-Ubuntu SMP Fri Mar 11 00:26:02 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
  • Terminal emulator:
    Iterm Build 2.9.20160313 over SSH

    Actual behaviour

screen shot 2016-03-28 at 6 00 21 pm

".vimrc" 622L, 17976C
function provider#python3#Call[9]..remote#host#Require[13]..provider#pythonx#Require, line 15
Vim(if):Channel was closed by the client
Failed to load python3 host. You can try to see what happened by starting Neovim with the environment variable $NVIM_PYTHON_LOG_FILE set to a file and opening t
he generated log file. Also, the host stderr will be available in Neovim log, so it may contain useful information. See also ~/.nvimlog.
Press ENTER or type command to continue
  • ~/.nvimlog
  • ~/nvim/$NVIM_PYTHON_LOG_FILE
2016-03-28 18:03:46,004 [ERROR @ session.py:run:117] 5331 - Setup error: No module named 'script_host'

Weird, running Neovim as root doesn't give the message.

Using _vim-plug_ to install as followed:

Plug 'SirVer/ultisnips' "{{{
  let g:UltiSnipsExpandTrigger="<c-j>"
  let g:UltiSnipsJumpForwardTrigger="<c-j>"
  let g:UltiSnipsJumpBackwardTrigger="<c-k>"
  let g:UltiSnipsListSnippets="<c-u>"

"}}}

If i comment out this line, problem disappears with neovim

caused by vims design neovim only pending feedback

Most helpful comment

ah, brilliant - I had run upgrade neovim for pip1 and pip2; I hadn't run upgrade for pip3. This has fixed it for me; heaps thanks!

$  sudo pip3 install neovim --upgrade

All 10 comments

@perks: Given, that ultisnips was working with previous versions of neovim and that I do not see any ultisnips related error-messages, my guess is that it's not problem with ultisnips rather than in neovim. So I consider to report issue to the neovim dev.

I've also been seeing an error appear in neovim, slightly different message. Might not be related, but it could be. I can open a new issue if you think so.

Error detected while processing function provider#python3#Call:                                                                                                                                                     
line   18:                                                                                                                                                                                                          
no request handler registered for "python_execute"                                                                                                                                                                  
no request handler registered for "python_execute"                                                                                                                                                                  
Error detected while processing function UltiSnips#FileTypeChanged..provider#python3#Call:                                                                                                                          
line   18:                                                                                                                                                                                                          
no request handler registered for "python_execute"                                                                                                                                                                  
no request handler registered for "python_execute"  

I don't know if this is related but also ran across this:

An error occured. This is either a bug in UltiSnips or a bug in a
snippet definition. If you think this is a bug, please report it to
https://github.com/SirVer/ultisnips/issues/new.

Following is the full stack trace:
Traceback (most recent call last):
  File "/home/chris/.vim/plugged/ultisnips/pythonx/UltiSnips/snippet_manager.py", line 61, in wrapper
    return func(self, *args, **kwds)
  File "/home/chris/.vim/plugged/ultisnips/pythonx/UltiSnips/snippet_manager.py", line 848, in _track_change
    before = _vim.buf.line_till_cursor
  File "/home/chris/.vim/plugged/ultisnips/pythonx/UltiSnips/_vim.py", line 46, in line_till_cursor
    _, col = self.cursor
  File "/home/chris/.vim/plugged/ultisnips/pythonx/UltiSnips/_vim.py", line 63, in cursor
    col = byte2col(line, nbyte)
  File "/home/chris/.vim/plugged/ultisnips/pythonx/UltiSnips/compatibility.py", line 40, in byte2col
    line = vim.current.buffer[line - 1]
  File "/usr/local/lib/python3.4/dist-packages/neovim/api/buffer.py", line 34, in __getitem__
    return self._session.request('buffer_get_line', self, idx)
  File "/usr/local/lib/python3.4/dist-packages/neovim/api/nvim.py", line 130, in request
    return walk(self._from_nvim, res, decode=decode)
  File "/usr/local/lib/python3.4/dist-packages/neovim/api/common.py", line 172, in walk
    return fn(obj, *args, **kwargs)
  File "/usr/local/lib/python3.4/dist-packages/neovim/api/nvim.py", line 99, in _from_nvim
    obj = decode_if_bytes(obj, decode)
  File "/usr/local/lib/python3.4/dist-packages/neovim/api/common.py", line 161, in decode_if_bytes
    return obj.decode("utf-8", errors=mode)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 10: invalid start byte

In my case running as root does give an error. Running vim does not give this message. For the rest details are exactly the same as OP

If you get the no request handler registered for "python_execute" you might need to upgrade neovim (master, or 0.1.3 as released should be fine, 0.1.3-dev could be too old)

@perks it looks like you have illegal utf-8 in the buffer. It seems vim+py3 allows retrieving the text using surrogate codepoints, but setting the text then fails (py3 vim.current.line is ok, but vim.current.line = vim.current.line + "x" is not). However neovim errors already on vim.current.line As the goal of the neovim python support is to be as close as possible to vim , this is a neovim bug.

I'm on NVIM v0.1.4-40-g4eb5827 with the error of Failed to load python3 host.

And both pip2 show neovim and pip3 show neovim shows 0.1.7 ?

ah, brilliant - I had run upgrade neovim for pip1 and pip2; I hadn't run upgrade for pip3. This has fixed it for me; heaps thanks!

$  sudo pip3 install neovim --upgrade

@bfredl: Thanks for investigating!

I'm also running to a related issue. When I start neovim, I see

Error detected while processing function provider#python3#Call:
line   18:
no request handler registered for "python_execute"

I ran into this issue after reinstalling python (and hence reinstalling the neovim package). This was a clean reinstall using conda 4.0.5. My versions before and after:

| Python install | neovim version |
| :-: | :-: |
| new | 0.1.7 |
| old | 0.1.5 |

The problem disappears when commenting out Plug 'sirver/UltiSnips'. Running sudo nvim does not fix the issue.

Was this page helpful?
0 / 5 - 0 ratings