jalvesaq / zotcite

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

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

Closed iGormilhit closed 2 months ago

iGormilhit commented 3 months 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 3 months 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 3 months 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 3 months 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 3 months ago

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

jalvesaq commented 3 months ago

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

iGormilhit commented 3 months ago

@jalvesaq Thanks!

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

iGormilhit commented 3 months ago

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

jalvesaq commented 3 months 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 months 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
jalvesaq commented 2 months ago

Any news on this? As I said, the !pandoc command works on my side and I can't fix a bug without knowing what's causing it.

iGormilhit commented 2 months ago

I've add zotref.py by myself in the system $PATH. And now I can use pandoc with the filter. I don't know why the zotcite mechanism of doing it doesn't work on my system.

Sorry for my late answer, I'm quite busy these days.

jalvesaq commented 2 months ago

Thanks for the feedback! I'm closing the issue. Please, make a pull request fixing it if you find its cause.