maralla/completor.vim

Installation Problem

Closed this issue · 9 comments

I installed completor.vim with vim-plug as follows:

Plug 'maralla/completor.vim'
let g:completor_python_binary = '/home/dai/anaconda3/bin/python'
let g:completor_filetype_map = {'python.django': 'python'}

But the following error occured while editing python files.
screenshot from 2018-05-20 18 19 07

I checked the log.

2018-05-20 17:55:04,961 [ERROR][python_jedi] Expecting value: line 2 column 1 (char 1)
Traceback (most recent call last):
  File "python_jedi.py", line 84, in run
    args = json.loads(data)
  File "/home/dai/anaconda3/lib/python3.6/json/__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "/home/dai/anaconda3/lib/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/home/dai/anaconda3/lib/python3.6/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 2 column 1 (char 1)
2018-05-20 17:55:05,147 [ERROR][python_jedi] Expecting value: line 2 column 1 (char 1)
Traceback (most recent call last):
  File "python_jedi.py", line 84, in run
    args = json.loads(data)
  File "/home/dai/anaconda3/lib/python3.6/json/__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "/home/dai/anaconda3/lib/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/home/dai/anaconda3/lib/python3.6/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 2 column 1 (char 1)

I have searched online, didn't find a solution. Any help is appreciated.

Could you please run the command :messages in you vim after the Error detected while processing function... error happened and post the result here?

@maralla Thank you for your reply.

Messages maintainer: Bram Moolenaar <Bram@vim.org>
"a.py" 41L, 812C
Error detected while processing function <lambda>1[1]..completor#do[1]..<SNR>70_import_python[2]..completor#utils#setup_python:
line    1:
Traceback (most recent call last):
Error detected while processing function <lambda>1[1]..completor#do[1]..<SNR>70_import_python[2]..completor#utils#setup_python:
line    1:
  File "<string>", line 1, in <module>
Error detected while processing function <lambda>1[1]..completor#do[1]..<SNR>70_import_python[2]..completor#utils#setup_python:
line    1:
ModuleNotFoundError: No module named 'completor'
Error detected while processing function <lambda>1[1]..completor#do[7]..completor#utils#get_completer:
line    1:
Traceback (most recent call last):
Error detected while processing function <lambda>1[1]..completor#do[7]..completor#utils#get_completer:
line    1:
  File "<string>", line 1, in <module>
Error detected while processing function <lambda>1[1]..completor#do[7]..completor#utils#get_completer:
line    1:
NameError: name 'completor_api' is not defined
Error detected while processing function <lambda>1[1]..completor#do[7]..completor#utils#get_completer:
line    2:
Traceback (most recent call last):
Error detected while processing function <lambda>1[1]..completor#do[7]..completor#utils#get_completer:
line    2:
  File "<string>", line 1, in <module>
Error detected while processing function <lambda>1[1]..completor#do[7]..completor#utils#get_completer:
line    2:
NameError: name 'res' is not defined
Error detected while processing function <lambda>1[1]..completor#do[7]..completor#utils#get_completer:
line    2:
E858: Eval did not return a valid python object
Error detected while processing function <lambda>2[1]..completor#do[7]..completor#utils#get_completer:
line    1:
Traceback (most recent call last):
Error detected while processing function <lambda>2[1]..completor#do[7]..completor#utils#get_completer:
line    1:
  File "<string>", line 1, in <module>
Error detected while processing function <lambda>2[1]..completor#do[7]..completor#utils#get_completer:
line    1:
NameError: name 'completor_api' is not defined
Error detected while processing function <lambda>2[1]..completor#do[7]..completor#utils#get_completer:
line    2:
Traceback (most recent call last):
Error detected while processing function <lambda>2[1]..completor#do[7]..completor#utils#get_completer:
line    2:
  File "<string>", line 1, in <module>
Error detected while processing function <lambda>2[1]..completor#do[7]..completor#utils#get_completer:
line    2:
NameError: name 'res' is not defined
Error detected while processing function <lambda>2[1]..completor#do[7]..completor#utils#get_completer:

The above is the first screen, the same error messages are repeated till the end of :messages.

Run this command in your terminal:

$ vim -c ":py import completor;print('ok')" -c "qall" -T dumb

and check whether ok is shown.

Nope, it said ImportError: No module named completor.
screenshot from 2018-05-21 16 17 17
Because of my python version? I'm using python anaconda version, but I have pointed that python binary.

Run vim and execute the command scriptnames to check the existence of <plug path>/completor.vim/plugin/completor.vim. If the plugin is missing, the installation of completor is failed. If not ls the content of <plug path>/completor.vim/pythonx and post the result.

@maralla Thank you for your reply.
<plug-path>/completor.vim/plugin/completor.vim exists.
I tried $ vim -c ":py import completor;print('ok')" -c "qall" -T dumb again. It gave me 'ok'.
I listed the directories in <plug path>/completor.vim/pythonx. It gave me two directories, completers and completor.
However, I still get the following error when i edit a python file;

Error detected while processing function <lambda>1[1]..completor#do[1]..<SNR>71_import_python[2]..completor#utils#setup_python:
line    1:
Traceback (most recent call last):
Error detected while processing function <lambda>1[1]..completor#do[1]..<SNR>71_import_python[2]..completor#utils#setup_python:
line    1:
  File "<string>", line 1, in <module>
Error detected while processing function <lambda>1[1]..completor#do[1]..<SNR>71_import_python[2]..completor#utils#setup_python:
line    1:
ModuleNotFoundError: No module named 'completor'
Error detected while processing function <lambda>1[1]..completor#do[7]..completor#utils#get_completer:

The error is saying completor module not found and completor_api is not defined. I think somehow the installation is not successful with vim-plug. Is the completor module going to be installed in the python path? Or it's not okay with the other plugins I have installed. I have no idea. Please have a look when you have a little spare time. At the same time, I'm going to experiment your pack and see it works with pack installation. Thank you very much for your time.
P.S: I'm on Solus GNU/Linux. I'm not sure it is the reason.

Could you please disable (comment out) all plugins except completor to see whether the problem still exists?

Yes, the problem still exists although I have disabled all plugins. I want to try pack, it looks cool and clean. I'll get back to you. Just for the reference, from :messages,

Error detected while processing function <lambda>1[1]..completor#do[1]..<SNR>32_import_python[2]..completor#utils#setup_python:
line    1:
Traceback (most recent call last):
Error detected while processing function <lambda>1[1]..completor#do[1]..<SNR>32_import_python[2]..completor#utils#setup_python:
line    1:
  File "<string>", line 1, in <module>
Error detected while processing function <lambda>1[1]..completor#do[1]..<SNR>32_import_python[2]..completor#utils#setup_python:
line    1:
ModuleNotFoundError: No module named 'completor'
Error detected while processing function <lambda>1[1]..completor#do[7]..completor#utils#get_completer:
line    1:
Traceback (most recent call last):
Error detected while processing function <lambda>1[1]..completor#do[7]..completor#utils#get_completer:
line    1:
  File "<string>", line 1, in <module>
Error detected while processing function <lambda>1[1]..completor#do[7]..completor#utils#get_completer:
line    1:
NameError: name 'completor_api' is not defined
Error detected while processing function <lambda>1[1]..completor#do[7]..completor#utils#get_completer:
line    2:
Traceback (most recent call last):
Error detected while processing function <lambda>1[1]..completor#do[7]..completor#utils#get_completer:
line    2:
  File "<string>", line 1, in <module>
Error detected while processing function <lambda>1[1]..completor#do[7]..completor#utils#get_completer:
line    2:
NameError: name 'res' is not defined
Error detected while processing function <lambda>1[1]..completor#do[7]..completor#utils#get_completer:
line    2:
E858: Eval did not return a valid python object
Error detected while processing function <lambda>2[1]..completor#do[7]..completor#utils#get_completer:
line    1:
Traceback (most recent call last):
Error detected while processing function <lambda>2[1]..completor#do[7]..completor#utils#get_completer:
line    1:
  File "<string>", line 1, in <module>
Error detected while processing function <lambda>2[1]..completor#do[7]..completor#utils#get_completer:
line    1:
NameError: name 'completor_api' is not defined
Error detected while processing function <lambda>2[1]..completor#do[7]..completor#utils#get_completer:
line    2:
Traceback (most recent call last):
Error detected while processing function <lambda>2[1]..completor#do[7]..completor#utils#get_completer:
line    2:
  File "<string>", line 1, in <module>
Error detected while processing function <lambda>2[1]..completor#do[7]..completor#utils#get_completer:
line    2:
NameError: name 'res' is not defined
Error detected while processing function <lambda>2[1]..completor#do[7]..completor#utils#get_completer:

@maralla Hi Wei Zhang, I found the problem. It is because of python anaconda distribution. I removed anaconda. Now completor is working like charm. By the way, I like pack too. Thank you for that. My vimrc will be a lot cleaner. Let me close the issue.
screenshot from 2018-06-06 17 57 50