Ultisnips: IOError in open_ascii_file

Created on 30 Apr 2017  路  2Comments  路  Source: SirVer/ultisnips

.vimrc:

let g:UltiSnipsSnippetDirectories  = $HOME.'/.vim/UltiSnips'
let g:UltiSnipsExpandTrigger       = "<c-k>"
let g:UltiSnipsJumpForwardTrigger  = "<c-k>"
let g:UltiSnipsJumpBackwardTrigger = "<s-c-j>"

The first variable is recommended from the docs:

If only one directory is specified in this variable and this directory is
specified by absolute path, UltiSnips will not look for snippets in
&runtimepath, which can lead to significant speedup. So, the common case is:

let g:UltiSnipsSnippetDirectories=$HOME.'/.vim/UltiSnips'

However, you will not able to use snippets that are shipped with third party
plugins out of the box. You'll need to copy them into your chosen directory.

Output when opening a .py file in vim:

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 "/Users/VictorAlvarez/.vim/plugged/ultisnips/pythonx/UltiSnips/err_to_scratch_buffer.py", line 16, in wrapper
    return func(self, *args, **kwds)
  File "/Users/VictorAlvarez/.vim/plugged/ultisnips/pythonx/UltiSnips/snippet_manager.py", line 151, in snippets_in_current_scope
    snippets = self._snips(before, True)
  File "/Users/VictorAlvarez/.vim/plugged/ultisnips/pythonx/UltiSnips/snippet_manager.py", line 575, in _snips
    source.ensure(filetypes, cached=autotrigger_only)
  File "/Users/VictorAlvarez/.vim/plugged/ultisnips/pythonx/UltiSnips/snippet/source/file/_base.py", line 47, in ensure
    self._load_snippets_for(ft)
  File "/Users/VictorAlvarez/.vim/plugged/ultisnips/pythonx/UltiSnips/snippet/source/file/_base.py", line 80, in _load_snippets_for
    self._parse_snippets(ft, fn)
  File "/Users/VictorAlvarez/.vim/plugged/ultisnips/pythonx/UltiSnips/snippet/source/file/_base.py", line 93, in _parse_snippets
    file_data = compatibility.open_ascii_file(filename, 'r').read()
  File "/Users/VictorAlvarez/.vim/plugged/ultisnips/pythonx/UltiSnips/compatibility.py", line 76, in open_ascii_file
    return open(filename, mode)
IOError: [Errno 21] Is a directory: u'/Users/VictorAlvarez/.vim/plugged/YouCompleteMe/python/ycm'
can't reproduce pending feedback traceback

Most helpful comment

I have this exact same issue. Was a solution or workaround found for this?

All 2 comments

I have this exact same issue. Was a solution or workaround found for this?

First:

let g:UltiSnipsSnippetDirectories  = $HOME.'/.vim/UltiSnips'

should be list:

let g:UltiSnipsSnippetDirectories  = [$HOME.'/.vim/UltiSnips']

Second:
Please attach some.py file. I can't reproduce it with empty test.py file.
Ideally please provide a docker repo. See CONTRIBUTING.md#reproducing-bugs

Was this page helpful?
0 / 5 - 0 ratings