roxma / nvim-yarp

Yet Another Remote Plugin Framework for Neovim
MIT License
230 stars 14 forks source link

need help, can't get nvim-yarp to work! #31

Closed ApolloTang closed 5 years ago

ApolloTang commented 5 years ago

Here is my minimum vimrc:


    set nocompatible
    set hidden          " Handle multiple buffers better.
    set laststatus=2    " Show the status line all the time

    let DIR = getcwd()
    echom 'getcwd(): '.DIR

    if !filereadable(DIR.'/dot-vim/plug.vim')
      echom 'executing curl...'
      silent !curl --insecure -fLo ./dot-vim/plug.vim
        \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
    endif

    call plug#begin(DIR.'/dot-vim/plugged')
      Plug 'https://github.com/roxma/nvim-yarp'
      Plug 'https://github.com/roxma/vim-hug-neovim-rpc'
    call plug#end()

    " Python Setting {
      " set pythondll=/usr/local/Frameworks/Python.framework/Versions/3.7/Python
      " set pythonhome=/usr/local/Frameworks/Python.framework/Versions/3.7
      set pythonthreedll=/usr/local/Frameworks/Python.framework/Versions/3.7/Python
      set pythonthreehome=/usr/local/Frameworks/Python.framework/Versions/3.7
    " }

    set pyxversion=3
    set encoding=utf-8

    echom 'neovim_rpc#serveraddr(): '.neovim_rpc#serveraddr()
    echom "exepth('python3'): ".exepath('python3')

    let $NVIM_PYTHON_LOG_FILE=DIR."/nvim_log"
    let $NVIM_PYTHON_LOG_LEVEL="DEBUG"

    echom '$NVIM_PYTHON_LOG_FILE: '.$NVIM_PYTHON_LOG_FILE

    " Create a python3 process running the hello module. The process is lazy load.
    let s:hello = yarp#py3('hello')

    com HelloSync call s:hello.request('greet')
    com HelloAsync call s:hello.notify('greet')

    " You could type :Hello greet
    com -nargs=1 Hello call s:hello.request(<f-args>)

running the above in a sandbox:

$ vim -u dot-vimrc test.ts
getcwd(): /Users/apollotang/Desktop/vim-sandbox/0200-fixing-nvim-yarp/01-minimum-nvim-yarp
neovim_rpc#serveraddr(): /Users/apollotang/tmp/v96zgor/0
exepth('python3'): /usr/local/bin/python3
$NVIM_PYTHON_LOG_FILE: /Users/apollotang/Desktop/vim-sandbox/0200-fixing-nvim-yarp/01-minimum-nvim-yarp/nvim_log
Press ENTER or type command to continue

then in vim command line:

:Hello greet

Screen Shot 2019-06-09 at 7 02 36 PM

So I try to run the same command in my terminal:

~/Desktop
$ python3 -u vim-sandbox/0200-fixing-nvim-yarp/01-minimum-nvim-yarp/dot-vim/plugged/nvim-yarp/pythonx/yarp.py /Users/apollotang/tmp/v96zgor/0 2 hello
Traceback (most recent call last):
  File "vim-sandbox/0200-fixing-nvim-yarp/01-minimum-nvim-yarp/dot-vim/plugged/nvim-yarp/pythonx/yarp.py", line 65, in <module>
    module_obj = importlib.import_module(module)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'hello'

the log file is at: this link

This minimum set up can be found at: here

vim version: Screen Shot 2019-06-09 at 7 19 48 PM

I know nothing on python, but here is my python3 version: Screen Shot 2019-06-09 at 7 22 35 PM

Thanks for helping !

ApolloTang commented 5 years ago

k, i think i figure this out, I have to put hello.py in nvim-yarp/pythonx/, close