Giter Club home page Giter Club logo

Comments (21)

rafaqz avatar rafaqz commented on May 18, 2024

Hi thanks! Hope we can get it working for you. It hasn't been tested much outside of my system yet so bear with me.

mhoffman had some similar issues yesterday:
#1

There were some errors in my readme... Pull the latest changes and have another look. The problem is probably the square brackets around the citation_vim_zotero_folder variable. Remove those and see how it goes. also the actual zotero folder is usually a lower case folder something like /Zotero/xxrandomyyy.default/zotero. I have no idea why its like that but check for that kind of path. It needs to contain a file named zotero.sqlite. I'll add that to the readme.

from citation.vim.

hongyuanjia avatar hongyuanjia commented on May 18, 2024

Thanks for your quick reply.

I pulled the latest version of the plugin and deleted the square brackets around the citation_vim_zotero_folder

let g:citation_vim_mode="zotero"
let g:citation_vim_zotero_folder="c:/Users/jiaho/OneDrive\ -\ PersonalOnedrive/3-Literatures/Zotero/"
let g:citation_vim_cache_path='~/vimfiles/Citation'

But I still got the same error messages.

By the way, I changed the default zotero folder and put it into my onedrive so that it can be synchronized between my office computer and my personal computer. And I am sure there is a zotero.sqlite file in that folder.

Actually, I installed pybtex and tried to use the bibtex source, and still got the same issue. I also downloaded Unite-Bibtex and it didn't work neither with similar error messages. That makes me wonder whether all these errors occur because of some python environment issues. I have 41 plugins installed and all other work perfectly. I have no idea how to figure it out.

Please help! Thanks.

from citation.vim.

rafaqz avatar rafaqz commented on May 18, 2024

Unite errors are pretty generic... basically anything wrong gives that error. There is a test script in the plugin but it requires a pretty arcane command line:

python3 test.py /your/zotero/folder/ zotero /your/cache/path citation key ""

Swap in: python2 /your/bibtex/file bibtex etc.

The python errors from that will be way more descruptive.

Also try deleting the cache file!! Sometimes its stored but corrupted...

from citation.vim.

rafaqz avatar rafaqz commented on May 18, 2024

Ok I found bug that might solve this. Currently you need to set both zotero and bibtex paths. Ive allways had both so I never noticed. The unused one can be anything at all just set it. I'll push a fix over the weekend...

from citation.vim.

rafaqz avatar rafaqz commented on May 18, 2024

Fixed. Hope that is what it was.

from citation.vim.

hongyuanjia avatar hongyuanjia commented on May 18, 2024

I am sorry but it still does not work for me after I pulled the latest version.

But here, I got some information that may be useful for dubuging:

I go to the ~/vimfiles/bundle/citation.vim/python/citation_vim/, and open cmd as an Administrator, and run the following command:

test.py c:/Users/jiaho/OneDrive\ -\ PersonalOnedrive/3-Literatures/Zotero zotero c:/Program\ Files/Vim/Citation citation key ""

It returned:

g:citation_vim_mode must be either 'zotero' or 'bibtex'
Traceback (most recent call last):
  File "C:\Program Files\Vim\vimfiles\bundle\citation.vim\python\citation_vim\test.py", line 22, in <module>
    items = builder.build_list()
  File "C:\Program Files\Vim\vimfiles\bundle\citation.vim\python\citation_vim\..\citation_vim\citation.py", line 54, in build_list
    for item in self.get_items():
  File "C:\Program Files\Vim\vimfiles\bundle\citation.vim\python\citation_vim\..\citation_vim\citation.py", line 75, in get_items
    parser = self.get_parser()
  File "C:\Program Files\Vim\vimfiles\bundle\citation.vim\python\citation_vim\..\citation_vim\citation.py", line 102, in get_parser
    return parser
UnboundLocalError: local variable 'parser' referenced before assignment

It seems that the spaces in my folder names cause some problems. I copied my zotero folder into the desktop folder and created a new folder named cache. And ran the following command:

test.py c:/Users/jiaho/Desktop/Zotero/ zotero c:/Users/jiaho/Desktop/cache citation key ""

then it returned:

C:\Program Files\Vim\vimfiles\bundle\citation.vim\python\citation_vim>test.py c:/Users/jiaho/Desktop/Zotero/ zotero c:/Users/jiaho/Desktop/cache citation key ""
Traceback (most recent call last):
  File "C:\Program Files\Vim\vimfiles\bundle\citation.vim\python\citation_vim\test.py", line 22, in <module>
    items = builder.build_list()
  File "C:\Program Files\Vim\vimfiles\bundle\citation.vim\python\citation_vim\..\citation_vim\citation.py", line 54, in build_list
    for item in self.get_items():
  File "C:\Program Files\Vim\vimfiles\bundle\citation.vim\python\citation_vim\..\citation_vim\citation.py", line 88, in get_items
    items = parser.load()
  File "C:\Program Files\Vim\vimfiles\bundle\citation.vim\python\citation_vim\..\citation_vim\zotero\parser.py", line 31, in load
    citekeys = bb.load_citekeys()
  File "C:\Program Files\Vim\vimfiles\bundle\citation.vim\python\citation_vim\..\citation_vim\zotero\betterbibtex.py", line 44, in load_citekeys
    citekeys[item['itemID']] = item['citekey']
KeyError: 'citekey'

And I found a zotero.sqlite generated in the cache folder.
That's what I got for now. Any insights? Thanks!

from citation.vim.

rafaqz avatar rafaqz commented on May 18, 2024

Aarg ok that's a problem loading better bibtex citation keys. I need more
error handling in there. It's annoyingly complicated to get them.

Try using bibtex mode as well, that might work now, its much simpler
internally.

(your first command didn't have quotes around arguments with spaces in
them!)

On Sat, Aug 27, 2016 at 4:11 AM, jiahony [email protected] wrote:

I am sorry but it still does not work for me after I pulled the latest
version.

But here, I got some information that may be useful for dubuging:

I go to the ~/vimfiles/bundle/citation.vim/python/citation_vim/, and open
cmd as an Administrator, and run the following command:

test.py c:/Users/jiaho/OneDrive\ -\ PersonalOnedrive/3-Literatures/Zotero zotero c:/Program\ Files/Vim/Citation citation key ""

It returned:

g:citation_vim_mode must be either 'zotero' or 'bibtex'
Traceback (most recent call last):
File "C:\Program Files\Vim\vimfiles\bundle\citation.vim\python\citation_vim\test.py", line 22, in
items = builder.build_list()
File "C:\Program Files\Vim\vimfiles\bundle\citation.vim\python\citation_vim..\citation_vim\citation.py", line 54, in build_list
for item in self.get_items():
File "C:\Program Files\Vim\vimfiles\bundle\citation.vim\python\citation_vim..\citation_vim\citation.py", line 75, in get_items
parser = self.get_parser()
File "C:\Program Files\Vim\vimfiles\bundle\citation.vim\python\citation_vim..\citation_vim\citation.py", line 102, in get_parser
return parser
UnboundLocalError: local variable 'parser' referenced before assignment

It seems that the spaces in my folder names cause some problems. I copied
my zotero folder into the desktop folder and created a new folder named
cache. And ran the following command:

test.py 'c:/Users/jiaho/Desktop/Zotero/' zotero 'c:/Users/jiaho/Desktop/cache' citation key ""

then it returned:

C:\Program Files\Vim\vimfiles\bundle\citation.vim\python\citation_vim>test.py c:/Users/jiaho/Desktop/Zotero/ zotero c:/Users/jiaho/Desktop/cache citation key ""
Traceback (most recent call last):
File "C:\Program Files\Vim\vimfiles\bundle\citation.vim\python\citation_vim\test.py", line 22, in
items = builder.build_list()
File "C:\Program Files\Vim\vimfiles\bundle\citation.vim\python\citation_vim..\citation_vim\citation.py", line 54, in build_list
for item in self.get_items():
File "C:\Program Files\Vim\vimfiles\bundle\citation.vim\python\citation_vim..\citation_vim\citation.py", line 88, in get_items
items = parser.load()
File "C:\Program Files\Vim\vimfiles\bundle\citation.vim\python\citation_vim..\citation_vim\zotero\parser.py", line 31, in load
citekeys = bb.load_citekeys()
File "C:\Program Files\Vim\vimfiles\bundle\citation.vim\python\citation_vim..\citation_vim\zotero\betterbibtex.py", line 44, in load_citekeys
citekeys[item['itemID']] = item['citekey']
KeyError: 'citekey'

And I found a zotero.sqlite generated in the cache folder.
That's what I got for now. Any insights? Thanks!


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#2 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACaqeXATBxNaKveW8wHkrMd9WuQkfbwvks5qjyxAgaJpZM4Jsgfq
.

from citation.vim.

rafaqz avatar rafaqz commented on May 18, 2024

A fix is pushed that lets empty keys go through. But there shouldn't be any
really... You might need to generate bibtex keys again.

On Sat, Aug 27, 2016 at 1:03 PM, Rafael Schouten [email protected]
wrote:

Aarg ok that's a problem loading better bibtex citation keys. I need more
error handling in there. It's annoyingly complicated to get them.

Try using bibtex mode as well, that might work now, its much simpler
internally.

(your first command didn't have quotes around arguments with spaces in
them!)

On Sat, Aug 27, 2016 at 4:11 AM, jiahony [email protected] wrote:

I am sorry but it still does not work for me after I pulled the latest
version.

But here, I got some information that may be useful for dubuging:

I go to the ~/vimfiles/bundle/citation.vim/python/citation_vim/, and
open cmd as an Administrator, and run the following command:

test.py c:/Users/jiaho/OneDrive\ -\ PersonalOnedrive/3-Literatures/Zotero zotero c:/Program\ Files/Vim/Citation citation key ""

It returned:

g:citation_vim_mode must be either 'zotero' or 'bibtex'
Traceback (most recent call last):
File "C:\Program Files\Vim\vimfiles\bundle\citation.vim\python\citation_vim\test.py", line 22, in
items = builder.build_list()
File "C:\Program Files\Vim\vimfiles\bundle\citation.vim\python\citation_vim..\citation_vim\citation.py", line 54, in build_list
for item in self.get_items():
File "C:\Program Files\Vim\vimfiles\bundle\citation.vim\python\citation_vim..\citation_vim\citation.py", line 75, in get_items
parser = self.get_parser()
File "C:\Program Files\Vim\vimfiles\bundle\citation.vim\python\citation_vim..\citation_vim\citation.py", line 102, in get_parser
return parser
UnboundLocalError: local variable 'parser' referenced before assignment

It seems that the spaces in my folder names cause some problems. I copied
my zotero folder into the desktop folder and created a new folder named
cache. And ran the following command:

test.py 'c:/Users/jiaho/Desktop/Zotero/' zotero 'c:/Users/jiaho/Desktop/cache' citation key ""

then it returned:

C:\Program Files\Vim\vimfiles\bundle\citation.vim\python\citation_vim>test.py c:/Users/jiaho/Desktop/Zotero/ zotero c:/Users/jiaho/Desktop/cache citation key ""
Traceback (most recent call last):
File "C:\Program Files\Vim\vimfiles\bundle\citation.vim\python\citation_vim\test.py", line 22, in
items = builder.build_list()
File "C:\Program Files\Vim\vimfiles\bundle\citation.vim\python\citation_vim..\citation_vim\citation.py", line 54, in build_list
for item in self.get_items():
File "C:\Program Files\Vim\vimfiles\bundle\citation.vim\python\citation_vim..\citation_vim\citation.py", line 88, in get_items
items = parser.load()
File "C:\Program Files\Vim\vimfiles\bundle\citation.vim\python\citation_vim..\citation_vim\zotero\parser.py", line 31, in load
citekeys = bb.load_citekeys()
File "C:\Program Files\Vim\vimfiles\bundle\citation.vim\python\citation_vim..\citation_vim\zotero\betterbibtex.py", line 44, in load_citekeys
citekeys[item['itemID']] = item['citekey']
KeyError: 'citekey'

And I found a zotero.sqlite generated in the cache folder.
That's what I got for now. Any insights? Thanks!


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#2 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACaqeXATBxNaKveW8wHkrMd9WuQkfbwvks5qjyxAgaJpZM4Jsgfq
.

from citation.vim.

hongyuanjia avatar hongyuanjia commented on May 18, 2024

Still cannot make it work for me.
I got the same error messages in vim with the settings below:

let g:citation_vim_mode="zotero"
let g:citation_vim_zotero_folder="c:/Users/jiaho/Desktop/Zotero/"
let g:citation_vim_cache_path="c:/Users/jiaho/Desktop/Cache/"

So I tried to run the test.py again with command below:

test.py c:/Users/jiaho/Desktop/Zotero/ zotero c:/Users/jiaho/Desktop/cache citation key ""

It finally started to work but I ran into some encoding issue with some citations which contain Latin characters.

Field:
CENC5IG8

Description:
journalArticle∶ [CENC5IG8] "Experimental study on the cooling capacity of a radiant cooled ceiling system" -Andrés-Chicote, Tejero-González, Velasco-Gómez, & Rey-Martínez- (2012)

File:
Traceback (most recent call last):
  File "C:\Users\jiaho\Desktop\citation.vim\python\citation_vim\test.py", line 29, in <module>
    print(file)
UnicodeEncodeError: 'gbk' codec can't encode character u'\xc3' in position 16: illegal multibyte sequence

I don't know why it tried to use gbk to encode those characters. By the way, I am Chinese, so there are some Chinese citations in the zotero database. They could be successfully loaded.

from citation.vim.

rafaqz avatar rafaqz commented on May 18, 2024

That could just be your console python settings... Is it working it vim?

Try this for the console: export PYTHONIOENCODING=UTF-8

from citation.vim.

rafaqz avatar rafaqz commented on May 18, 2024

If you can't get it working maybe attach a zotoero export?

from citation.vim.

hongyuanjia avatar hongyuanjia commented on May 18, 2024

That could just be your console python settings... Is it working it vim?

No, it didn't work in vim. No matter I use zotero source or bibtex source.

Try this for the console: export PYTHONIOENCODING=UTF-8

I tried in cmd and it returned export is not recognized as an internal or external command, operable program or batch file.
Should I try in some other command line program? Sorry, I know nothing about python.

If you can't get it working maybe attach a zotoero export?

This is my zotero database file. zotero.sqlite

By the way, I am using vim-pandoc together with vim to write markdown files. It has a feature that uses pandoc-citeproc to parse bibtex files and autocomplete citation keys, and it works well. But the backwards of this is that I have to export all my library into a bib file which is a little bit inconvenient.

from citation.vim.

rafaqz avatar rafaqz commented on May 18, 2024

That's exactly the setup I use, and why I added zotero support... fulltext
search was a bonus.

Can you also post your better bibtex folder and sqlite file? or whatever is
there... they keep changing the format.

On Mon, Aug 29, 2016 at 10:57 AM, jiahony [email protected] wrote:

That could just be your console python settings... Is it working it vim?

No, it didn't work in vim. No matter I use zotero source or bibtex source.

Try this for the console: export PYTHONIOENCODING=UTF-8

I tried in cmd and it returned export is not recognized as an internal or
external command, operable program or batch file.
Should I try in some other command line program? Sorry, I know nothing
about python.

If you can't get it working maybe attach a zotoero export?

This is my zotero database file. zotero.sqlite
https://1drv.ms/u/s!AlPDsV4LrMrnp6dCxcwikZpWn-2Ndw

By the way, I am using vim-pandoc
https://github.com/vim-pandoc/vim-pandoc together with vim to write
markdown files. It has a feature that uses pandoc-citeproc to parse
bibtex files and autocomplete citation keys, and it works well. But the
backwards of this is that I have to export all my library into a bib file
which is a little bit inconvenient.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#2 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACaqeeo7F_TK8F-9NIMT1eikgX9CTmPqks5qki5_gaJpZM4Jsgfq
.

from citation.vim.

rafaqz avatar rafaqz commented on May 18, 2024

And really you should use this plugin for pdf and url opening! that's the
main game changer...

On Mon, Aug 29, 2016 at 11:47 AM, Rafael Schouten [email protected]
wrote:

That's exactly the setup I use, and why I added zotero support... fulltext
search was a bonus.

Can you also post your better bibtex folder and sqlite file? or whatever
is there... they keep changing the format.

On Mon, Aug 29, 2016 at 10:57 AM, jiahony [email protected]
wrote:

That could just be your console python settings... Is it working it vim?

No, it didn't work in vim. No matter I use zotero source or bibtex source.

Try this for the console: export PYTHONIOENCODING=UTF-8

I tried in cmd and it returned export is not recognized as an internal
or external command, operable program or batch file.
Should I try in some other command line program? Sorry, I know nothing
about python.

If you can't get it working maybe attach a zotoero export?

This is my zotero database file. zotero.sqlite
https://1drv.ms/u/s!AlPDsV4LrMrnp6dCxcwikZpWn-2Ndw

By the way, I am using vim-pandoc
https://github.com/vim-pandoc/vim-pandoc together with vim to write
markdown files. It has a feature that uses pandoc-citeproc to parse
bibtex files and autocomplete citation keys, and it works well. But the
backwards of this is that I have to export all my library into a bib
file which is a little bit inconvenient.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#2 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACaqeeo7F_TK8F-9NIMT1eikgX9CTmPqks5qki5_gaJpZM4Jsgfq
.

from citation.vim.

hongyuanjia avatar hongyuanjia commented on May 18, 2024

Yes, this plugin provides a very attractive feature that can directly read zotero database, which makes me so desired to make it work. As far as I know, this is the only vim plugin that can do this.

I found that better bibtex uses json files rather than sqlite files as data restoring. I shared the whole zotero folder here.

Wish to get this great plugin work soon. Thanks.

from citation.vim.

rafaqz avatar rafaqz commented on May 18, 2024

Great I'll have a look... They have been swapping between those formats lately. its very annoying!

from citation.vim.

rafaqz avatar rafaqz commented on May 18, 2024

The latest push is working with your data on my setup. I wasn't handling variation in better bibtex formats but that should be fixed... Let me know if that works now.

from citation.vim.

hongyuanjia avatar hongyuanjia commented on May 18, 2024

Thank you @rafaqz . But I still ran into some errors this time. Here below is what I did:

First, I tried to run the test.py. I ran the following command in my cmd. Still got some errors on encoding.

C:\Program Files\Vim\vimfiles\bundle\citation.vim\python\citation_vim>test.py "c:\Users\jiaho\OneDrive - PersonalOnedrive\3-Literatures\Zotero" zotero "c:\Program Files\Vim\Citation" citation key ""

Field:
andres-chicote_experimental_2012

Description:
journalArticle∶ [andres-chicote_experimental_2012] "Experimental study on the cooling capacity of a radiant cooled ceiling system" -Andrés-Chicote, Tejero-González, Velasco-Gómez, & Rey-Martínez- (2012)

File:
Traceback (most recent call last):
  File "C:\Program Files\Vim\vimfiles\bundle\citation.vim\python\citation_vim\test.py", line 29, in <module>
    print(file)
UnicodeEncodeError: 'gbk' codec can't encode character u'\xc3' in position 16: illegal multibyte sequence

u'\xc3' in python is Ã. But there was no à in any citation fields. After I changed one of the author name from Tödtli to Todtli, the test.py can get pass of this citation, but would still stop wherever there was any Latin character in citations. After I deleted all citations that caused encoding errors, the test.py went through successfully.

Even though I ran test.py successfully, I still could not get the plugin work in Vim. I think it may due to differences of path expression on Windows and Linux. I tried many different writings of path. None of them worked.

  • Version 1: Double quotes with spaces escaped.
let g:citation_vim_mode='zotero'
let g:citation_vim_zotero_folder="c:/Users/jiaho/OneDrive\ -\ PersonalOnedrive/3-Literatures/Zotero"
let g:citation_vim_cache_path="c:/Program\ Files/Vim/Citation"
  • Version 2: Single quote with spaces escaped.
let g:citation_vim_mode='zotero'
let g:citation_vim_zotero_folder='c:/Users/jiaho/OneDrive\ -\ PersonalOnedrive/3-Literatures/Zotero'
let g:citation_vim_cache_path='c:/Program\ Files/Vim/Citation'
  • Version 3: Double quotes without spaces escaping.
let g:citation_vim_mode='zotero'
let g:citation_vim_zotero_folder="c:\Users\jiaho\OneDrive - PersonalOnedrive\3-Literatures\Zotero"
let g:citation_vim_cache_path="c:\Program Files\Vim\Citation"
  • Version 4: Single quote without spaces escaping.
let g:citation_vim_mode='zotero'
let g:citation_vim_zotero_folder='c:\Users\jiaho\OneDrive - PersonalOnedrive\3-Literatures\Zotero'
let g:citation_vim_cache_path='c:\Program Files\Vim\Citation'

Note: Version 3: Double quotes without spaces escaping is exactly what I used in the cmd to run test.py successfully.

I think python will directly read from the configuration of catation.vim in my _vimrc and, taking Version 3 as an example, join g:citation_vim_zotero_folder and c:\Program Files\Vim\Citation into a command like this:

test.py c:\Users\jiaho\OneDrive - PersonalOnedrive\3-Literatures\Zotero zotero c:\Program Files\Vim\Citation citation key ""

All quotes are moved when making commands. That's just what I guess. I even tried the following version:

  • Version 5: Double quotes quoted by single quote without spaces escaping.
let g:citation_vim_mode='zotero'
let g:citation_vim_zotero_folder='"c:\Users\jiaho\OneDrive - PersonalOnedrive\3-Literatures\Zotero"'
let g:citation_vim_cache_path='"c:\Program Files\Vim\Citation"'

And still don't work and get the same error messages in Vim.

It seems that I almost get there.
Any suggestions?

from citation.vim.

rafaqz avatar rafaqz commented on May 18, 2024

Have you tried changing your directory name to one without spaces - just to check your hypothesis before I jump into debugging that?

from citation.vim.

rafaqz avatar rafaqz commented on May 18, 2024

Also the encoding errors may just be on your console. I get no encoding errors running the test on linux with the same file. Look into windows python utf8 settings, I think windows set gbk as the default at some stage and you need to swap it to utf-8.

from citation.vim.

rafaqz avatar rafaqz commented on May 18, 2024

Try the latest version, I bit the bullet and implemented better error handling - you should get an error for what is going wrong in vim.

from citation.vim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.