Closed WingDust closed 3 years ago
what python version? see https://github.com/neovim/pynvim/pull/439 (merged but not released)
python :3.8.1
actually why is "gbk" encoding involved? Only utf8 is supported.
It seems binary file decoding error.
@rpc_export('python_execute_file', sync=True)
def python_execute_file(self, file_path, range_start, range_stop):
"""Handle the `pyfile` ex command."""
self._set_current_range(range_start, range_stop)
with open(file_path) as f:
script = compile(f.read(), file_path, 'exec')
try:
exec(script, self.module.__dict__)
except Exception:
raise ErrorResponse(format_exc_skip(1))
open()
opens file as text file.
But your opened file is invalid text(binary) file.
f.read()
decodes byte as gbk
codecs (system default encoding??), but it failed.
It is not #439 related problem.
I think open()
should use encoding argument to detect encoding.
I think
open()
should use encoding argument to detect encoding.
maybe we can show a better error. But supporting non-utf8 file for python_execute_file
does not seem like something we should do.
maybe we can show a better error. But supporting non-utf8 file for python_execute_file does not seem like something we should do.
If so, open(encoding='utf-8')
should be used instead.
And to add the documentation.
Note: I don't know what pyfile supports encodings in Vim8.
modify python_path\Lib\site-packages\pynvim\plugin\script_host.py
+107 can work.
with open(file_path, 'rb') as f: #with open(file_path) as f:
@bfredl Ping.
When will the fix be released? The issue still exists in the latest release.
@bfredl Ping. When the new version is released? This is very important problem for me.
version 0.4.3 is released. It should be closed.
Thanks.
neoclide/coc.nvim#1828 Before i through is
Coc.nvim
problem but now look like it'svim-snippets
Describe the bug
OS : window10 Neovim: 0.4.3 i check again the
CocInfo
it't return different messageCocInfo
Output channel: Python
Starting Jedi Python language engine.
Output channel: snippets
[Info 17:39:57] Using ultisnips directories: UltiSnips E:\spacemacs\emacs26-3\AppData\Local\coc\ultisnips [Info 17:39:58] Using ultisnips python command: pyx Error on execute python script: request error nvim_command - Vim(return):Error invoking 'python_execute_file' on channel 4 (python3-script-host): error caught in request handler 'python_execute_file ['C:\Users\ADMINI~1\AppData\Local\Temp\coc.nvim-6652\coc-ultisnips-KLQQlwM_rh.py', 1, 1]': Traceback (most recent call last): File "E:\python\python3.8.1\lib\site-packages\pynvim\plugin\script_host.py", line 106, in python_execute_file script = compile(f.read(), file_path, 'exec') UnicodeDecodeError: 'gbk' codec can't decode byte 0xa6 in position 18260: illegal multibyte sequence
init.vim
Try
I thought it's
cmd
default encoding problem so change toutf-8
but don't work