jalvesaq / zotcite

Neovim plugin for integration with Zotero
GNU General Public License v3.0
160 stars 13 forks source link

Trouble with my configuration? `:Zrefs` and `zotref.py` throwing errors #90

Open iGormilhit opened 2 weeks ago

iGormilhit commented 2 weeks ago

Hi,

I'm trying to use the zotcite plugin, with cmp_zotcite, and it's working fine for the @… completion, or with commands like :Zannotations or :Zseek, but I have trouble mainly with the :Zrefs command and the zotref.py filter (errors detailed below).

OS: archlinux. neovim: v0.10.1

My configuration is available here:

:checkhealth confirms that the python-provider is ok. I firstly tried with a 3.12 python version, with the same issues. So I tried the 3.10, but with no change.

provider.python: require("provider.python.health").check()

Python 3 provider (optional) ~
- pyenv: Path: /home/igor/.pyenv/libexec/pyenv
- pyenv: Root: /home/igor/.pyenv
- Using: g:python3_host_prog = "/home/igor/.pyenv/versions/py-nvim3.10/bin/python"
- Executable: /home/igor/.pyenv/versions/py-nvim3.10/bin/python
- Python version: 3.10.0
- pynvim version: 0.5.0
- OK Latest pynvim is installed.

Python virtualenv ~
- OK no $VIRTUAL_ENV

In the virtualenv are installed the following:

❯ pip list
Package    Version
---------- -------
greenlet   3.0.3
msgpack    1.0.8
pip        24.2
pynvim     0.5.0
PyQt5      5.15.11
PyQt5-Qt5  5.15.14
PyQt5_sip  12.15.0
PyYAML     6.0.2
setuptools 57.4.0

(I have trouble with the python-poppler-qt5 installation, but that's another story.)

I have other plugins installed, of course, such as vim-pandoc and vim-pandoc-syntax, but I tried to deactivate them, with no change in my issues.

When I open a .md file, which get the pandoc filetype through vim-pandoc, if I try to use the :Zrefs command, I get:

Error executing Lua callback: function provider#python3#Call, line 1: Vim(return):E5108: Error executing lu
a Vim:Error invoking 'python_eval' on channel 4 (python3-script-host):                                     
  File "<string>", line 1                                                                                  
    ZotCite.GetYamlRefs('#                                                                                 
                        ^                                                                                  
SyntaxError: unterminated string literal (detected at line 1)                                              
stack traceback:                                                                                           
        [C]: at 0x5eaf10abf200                                                                             
        [C]: in function 'py3eval'                                                                         
        ...gor/.local/share/nvim/lazy/zotcite/lua/zotcite/utils.lua:12: in function <.../.local/share/nvim/lazy/zotcite/lua/zotcite/utils.lua:7>                                                                   
stack traceback:                                                                                           
        [C]: in function 'py3eval'                                                                         
        ...gor/.local/share/nvim/lazy/zotcite/lua/zotcite/utils.lua:12: in function <.../.local/share/nvim/lazy/zotcite/lua/zotcite/utils.lua:7>

And with the zotref.py filter:

:!pandoc filename.md --to=html --output="filename.md" -F zotref.py --citeproc

I get the following error:

Error running filter zotref.py:                                                                            
Could not find executable zotref.py

I suspect that the issue comes from the python provider, but I've followed the documentation (https://neovim.io/doc/user/provider.html#python-virtualenv).

I will of course give further information if needed.

adam-coates commented 2 weeks ago

For me the pandoc command always needs the full path unless I export the full path in .bashrc to the plugin.

Perhaps having the full path to zotref.py works?

:!pandoc filename.md --to=html --output="filename.md" -F /home/user/.local/share/nvim/zotcite/python3/zotref.py --citeproc

iGormilhit commented 2 weeks ago

@adam-coates Yes, this way it works. But the documentation says that: "The Zotcite plugin adds the directory where zotref.py is to the system $PATH." I think I will add it to the $PATH myself.

Thanks for your answer.

adam-coates commented 2 weeks ago

Great glad it works.

As with Zrefs I've never used that before now, sorry I couldn't be much help in that area.

jalvesaq commented 2 weeks ago

Thanks for reporting the bugs! :Zrefs should be fixed now.

jalvesaq commented 2 weeks ago

I can't replicate the other issue. The pandoc command works on my side.

iGormilhit commented 2 weeks ago

@jalvesaq Thanks!

How the zotcite plugin add it's path to the system $PATH?

iGormilhit commented 2 weeks ago

@jalvesaq I confirm that the 06fa405 fix resolve the :Zrefs issue. :+1:

jalvesaq commented 2 weeks ago

How the zotcite plugin add it's path to the system $PATH?

It's in the lua/zotcite/config.lua. Just seek for "PATH". I made a minor change but I don't believe it will fix the issue on your side.

jalvesaq commented 2 weeks ago

Maybe you have set the PATH yourself... To check this possibility:

cd ~/.config/nvim
grep -R PATH

You can see the PATH environment variable with this command in Neovim:

:echo $PATH