You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I'm trying to use the python snippets but they are not working on my end, I've tried using html and csharp snippet already. One csharp snippet for example is the "class" one, that does this when I hit Tab:
functionprovider#python3#Call, line 1: Vim(return):E5108: Error executing lua Vim:Error invoking 'python_eval' on channel 3 (python3-script-host):
Traceback (most recent call last):
File "<string>", line 1, in<module>
NameError: name 'luasnip_snippets_python_helper' is not defined
stack traceback:
^I[C]: at 0x555cbad29e70
^I[C]: infunction'py3eval'
^I...snip-snippets/lua/luasnip_snippets/common/snip_utils.lua:296: infunction'c_py'
^I...e/nvim/lazy/luasnip-snippets/lua/luasnip_snippets/cs.lua:143: infunction'fn'
^I...hare/nvim/lazy/LuaSnip/lua/luasnip/nodes/dynamicNode.lua:152: infunction'update'
^I...al/share/nvim/lazy/LuaSnip/lua/luasnip/nodes/snippet.lua:1026: infunction'update'
^I...al/share/nvim/lazy/LuaSnip/lua/luasnip/nodes/snippet.lua:769: infunction'trigger_expand'
^I...h140/.local/share/nvim/lazy/LuaSnip/lua/luasnip/init.lua:272: infunction'snip_expand'
^I...cal/share/nvim/lazy/cmp_luasnip/lua/cmp_luasnip/init.lua:169: infunction'execute'
^I../<user>/.local/share/nvim/lazy/nvim-cmp/lua/cmp/source.lua:396: infunction'execute'
^I.../<user>/.local/share/nvim/lazy/nvim-cmp/lua/cmp/entry.lua:492: infunction'execute'
^I...e/<user>/.local/share/nvim/lazy/nvim-cmp/lua/cmp/core.lua:503: infunction<...e/<user>/.local/share/nvim/lazy/nvim-cmp/lua/cmp/core.lua:502>
^I[C]: infunction'pcall'
^I...ocal/share/nvim/lazy/nvim-cmp/lua/cmp/utils/feedkeys.lua:47: infunction'run'
^I[string ":lua"]:1: in main chunk
Since it's a "name is not defined" error I looked into the file snip_utils.lua:296 the name that it looks for and tried to import it using vim command bar with python3 import luasnip_snippets_python_helper and this happens:
E5108: Error executing lua Vim:Error invoking 'python_execute' on channel 3 (python3-script-host): Traceback (most recent call last):
File "<string>", line 1, in<module>
File "/home/<user>/.local/share/nvim/lazy/luasnip-snippets/pythonx/luasnip_snippets_python_helper.py", line 300, in<module> @functools.cache
AttributeError: module 'functools' has no attribute 'cache'
stack traceback:
[C]: at 0x555cbad29e70
From my search, it looks like functools 'cache' came only after Python 3.9, however updating it didn't work for me (I don't know if I did it right, but I downloaded Python 3.9, Python 3.12 and updated vim.g.python3_host_prog accordingly), it gives me this error when it's not set to "/usr/bin/python3.8":
nvim_exec2()..function provider#python3#Call[1]..remote#host#Require[10]..provider#python3#Require, line 1: Vim(return):E5108: Error executing lua nvim_exec2()..fu
nction provider#python3#Call[1]..remote#host#Require[10]..provider#python3#Require[1]..provider#Poll, line 17: Failed to load python3 host. You can try to see what
happened by starting nvim with $NVIM_PYTHON_LOG_FILEset and opening the generated log file. Also, the host stderr is available in messages.
stack traceback:
[C]: at 0x562df51efe70
[C]: at 0x562df51efe70
[C]: infunction'pcall'
...m-linux64/share/nvim/runtime/lua/vim/provider/python.lua:132: infunction<...m-linux64/share/nvim/runtime/lua/vim/provider/python.lua:125>
[C]: infunction'nvim_exec2'
vim/_editor.lua: infunction'cmd'
...snip-snippets/lua/luasnip_snippets/common/snip_utils.lua:289: infunction'load_python_helper'
...snip-snippets/lua/luasnip_snippets/common/snip_utils.lua:294: infunction'c_py'
...e/nvim/lazy/luasnip-snippets/lua/luasnip_snippets/cs.lua:143: infunction<...e/nvim/lazy/luasnip-snippets/lua/luasnip_snippets/cs.lua:143>
Error while evaluating dynamicNode@3 for snippet 'class':
...snip-snippets/lua/luasnip_snippets/common/snip_utils.lua:62: invalid value (userdata) at index 1 in table for'concat'
One solution for me, according to the answer of this stackoverflow thread, was to use lru_cache instead of cache in luasnip_snippets_python_helper.py:297
I don't know if that's a fix so I'm not doing a PR or anything yet, is there anything I can do to fix my end and probably help others as well? (maybe be explicit Python 3.9 >= is required?) or isn't it?
Thanks in advance.
Btw I am on WSL2 Ubuntu 20.04
The text was updated successfully, but these errors were encountered:
Hello, I'm trying to use the python snippets but they are not working on my end, I've tried using html and csharp snippet already. One csharp snippet for example is the "class" one, that does this when I hit Tab:
Since it's a "name is not defined" error I looked into the file
snip_utils.lua:296
the name that it looks for and tried to import it using vim command bar withpython3 import luasnip_snippets_python_helper
and this happens:From my search, it looks like functools 'cache' came only after Python 3.9, however updating it didn't work for me (I don't know if I did it right, but I downloaded Python 3.9, Python 3.12 and updated
vim.g.python3_host_prog
accordingly), it gives me this error when it's not set to "/usr/bin/python3.8":One solution for me, according to the answer of this stackoverflow thread, was to use
lru_cache
instead ofcache
in luasnip_snippets_python_helper.py:297I don't know if that's a fix so I'm not doing a PR or anything yet, is there anything I can do to fix my end and probably help others as well? (maybe be explicit Python 3.9 >= is required?) or isn't it?
Thanks in advance.
Btw I am on WSL2 Ubuntu 20.04
The text was updated successfully, but these errors were encountered: