Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

So here's an example of a vim plugin having python issues:

Error detected while processing function UltiSnipsEdit:
line    6:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\2c.2c2c\.vim\bundle\ultisnips\plugin\UltiSnips\__init__.py", line 981, in file_to_edit
    os.mkdir(path)
WindowsError: [Error 3] The system cannot find the path specified: u'C:\\Users\\2c.2c2c\\vimfiles\\UltiSnips'
line   16:
E121: Undefined variable: file
E15: Invalid expression: ':'.mode.' '.file

Errors similar to this from vim plugin makers all say this is an issue with your python environment. I have the latest 27x and 3xx builds of python and use a precompiled vim from http://tuxproject.de/projects/vim/. I've uninstalled/reinstalled one or the other version, installed both versions, both with and without paths set. Nothing seems to have an effect.

:version

returns python/dyn for both versions, although I've messed with changing paths/uninstalling-reinstalling to have them alone and not alone etc. To see if anything changes. Also, basic python appears to actually work, I can do

:python print ("hello")

with no issue.

I'm also kind of confused why it's checking that directory... Vundle adds rtps to ~/.vim/bundle/addon for anything it installs.

Anyways, I haven't seen anyone with an issue like this on Windows, so none of the information is very helpful. Any help is appreciated.

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

The error originates from the function files_to_edit() in file "C:\Users\2c.2c2c.vim\bundle\ultisnips\plugin\UltiSnips__init__.py". Given a filetype (e.g, "markdown") this function tries figure out where the file with corresponding snippets ("markdown.snippets") might be located in your system. The function checks several places:

  1. If global variable g:UltiSnipsSnippetsDir exists, then it looks in that folder
  2. If global variable g:UltiSnipsSnippetDirectories exists, then it iterates over the items in rtp, appends the directory from the variable, and looks in the resulting folders
  3. If none of the above is set, then it iterates over the items in rtp, appends "UltiSnips" , and looks in the resulting folders

According to your error message

WindowsError: [Error 3] The system cannot find the path specified: u'C:\Users\2c.2c2c\vimfiles\UltiSnips'

it ended up in the third option. For some reason, it did not pick up the correct item from rtp. What you could do to fix the problem without digging into the plugin source code and debugging it is set g:UltiSnipsSnippetsDir explicitly to the location where the snippets are stored, i.e. "C:\Users\2c.2c2c.vim\bundle\ultisnips\UltiSnips". Just drop the line

let g:UltiSnipsSnippetsDir = "C:\Users\2c.2c2c\.vim\bundle\ultisnips\UltiSnips"

somewhere in your .vimrc.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.