TaDaa / vimade

Vimade let's you dim, fade, tint, animate, and customize colors in your windows and buffers
Apache License 2.0
540 stars 10 forks source link

latest nvim startup python issue from has('python') ? #71

Closed mckellygit closed 2 years ago

mckellygit commented 2 years ago

@TaDaa, hi Thank you so much for vimade. With the latest neovim commits I now see this at nvim startup -

Error detected while processing function provider#pythonx#Detect[1]..provider#pythonx#DetectByModule[1]..<SNR>28_get_python_executable_from_host_var:
line    1:
E605: Exception not caught: unsupported
Press ENTER or type command to continue

But I think my python is ok ?

## Python 3 provider (optional)
  - INFO: Using: g:python3_host_prog = "/usr/bin/python3.8"
  - INFO: Executable: /usr/bin/python3.8
  - INFO: Python version: 3.8.10
  - INFO: pynvim version: 0.4.3
  - OK: Latest pynvim is installed.

## Python virtualenv
  - OK: no $VIRTUAL_ENV

and

% python --version
Python 3.8.10
% python3 --version
Python 3.8.10

This seems to be from pythonx.vim -

function! s:get_python_executable_from_host_var(major_version) abort
  return expand(get(g:, 'python'.(a:major_version == 3 ? '3' : execute("throw 'unsupported'")).'_host_prog', ''), v:true)
endfunction

I tracked it down to vimade plugin here -

    let g:vimade_features.has_python = has('python')

I do not understand why has('python') would cause the major_version to be 2, since my default python command is python3.8.10, but this is the line that somehow causes a python2 dependency in nvim. Do you have any idea why or a way to configure around this ? Perhaps I just need to remove python2 from my machine but I wonder if you know more. thx, -m

mckellygit commented 2 years ago

Something like this in autoload/vimade.vim is a workaround, but I don't want to change the plugin or build up all of g:vimade_features manually -

    if has('python3')
        let g:vimade_features.has_python  = v:false
        let g:vimade_features.has_python3 = v:true
    elseif has('python')
        let g:vimade_features.has_python  = v:true
        let g:vimade_features.has_python3 = v:false
    else
        let g:vimade_features.has_python  = v:false
        let g:vimade_features.has_python3 = v:false
    endif
mckellygit commented 2 years ago

There are some others finding has('python') causes the same issue so perhaps more research and testing of the nvim commit is needed. See https://github.com/neovim/neovim/pull/17252

TaDaa commented 2 years ago

Thanks for the details and opening the issue. Added a workaround that should solve the problem for the time being -- lmk if you still run into issues.

mckellygit commented 2 years ago

No vimade changes needed. Its an issue with some older nvim runtime files. After removing the nvim runtime files before a make install the error no longer happens. take care, -m