wshanks / lyz

LyZ is a plugin for Zotero, which is intended to make working with LyX/Zotero more pleasant.
GNU General Public License v3.0
108 stars 13 forks source link

Bib-file not being updated #6

Closed dpprdan closed 10 years ago

dpprdan commented 10 years ago

I've got pretty much the same problem as ser [https://github.com/willsALMANJ/lyz/issues/4]. So multi-document file in LyX, one .bib file. When I click "Update BibTeX", LyZ shows the "You are going to update BibTeX database:" warning with the correct path/file. But when I hit okay, the .bib file is not being updated. LyX shows the following debug messages:

15:17:08.615: D:/correct/path/to/file.lyxServer.cpp (633): LyXComm: nbytes:31, iobuf:, cmd:LYXCMD:lyz:server-get-filename Server.cpp (1078): Server: Received: 'LYXCMD:lyz:server-get-filename' Server.cpp (1122): Server: Client: 'lyz' Command: 'server-get-filename' Argument: '' Server.cpp (651): LyXComm: Sending 'INFO:lyz:server-get-filename:D:/correct/path/to/file.lyx ' Server.cpp (633): LyXComm: nbytes:31, iobuf:, cmd:LYXCMD:lyz:server-get-filename Server.cpp (1078): Server: Received: 'LYXCMD:lyz:server-get-filename' Server.cpp (1122): Server: Client: 'lyz' Command: 'server-get-filename' Argument: '' Server.cpp (651): LyXComm: Sending 'INFO:lyz:server-get-filename:D:/correct/path/to/file.lyx '

I also tried renaming the BibTeX record to no avail. Adding new references via "cite in LyX" still works. The BibTeX update worked fine with the same files just a few days ago. What may have broken it is that I tried to change the export format from BibTeX to BibLaTeX in the LyZ settings. I changed it back, but also no success.

Any ideas?

Zotero 4.0.19, LyZ 2.1.7

dpprdan commented 10 years ago

Nope the format change (BibTeX vs. BibLaTeX) was not it. Just tried with a new LyX document and a copy of the BibTeX file that I have been using all along. Inserting new citations and updating the BibTeX file just works. Also when I change the export format to BibLaTeX. While trying all different things I also get an error message that there is no BibTeX file associated with one of the old LyX files. Originally, there was a file associated with it of course. Adding a new citation and thus associating the BibTeX file with it works, but 'Update BibTeX' does not after that. Unfortunately I do not know what exact steps lead to the 'no association' error.

Is there a config file where all the file associations etc. are stored? Maybe somethings wrong there.

wshanks commented 10 years ago

LyZ stores its information about bibliographies in the SQLite database lyz.sqlite in the Zotero data directory. You can get to it by looking in the "Files and Folders" tab of the "Advanced" panel of Zotero's preferences.

I don't have a deep knowledge of how the pipe between LyZ and LyX works (I didn't write LyZ. I just maintain it to try to keep it working since the original developer no longer wanted to maintain it), so I don't have a good guess of what is causing this problem. The problem for me is that this issue seems to come up intermittently without an obvious cause (for you and Ser at least), so it is hard for me to reproduce to try to see what the problem is.

This statement in the README was written by the original developer:

Only current LyX document will be updated. Multiple document update is implemented, but seems unreliable. Needs more testing… Synchronization between LyX/BibTeX/LyZ

This statement might be related to your issue.

Here are some things you can try:

  1. Launch the Browser Console (see: https://developer.mozilla.org/en-US/docs/Debugging_JavaScript ) and look for LyZ related errors when you try to Update BibTeX. They should be under JS. You can mute the other kinds of errors and clear any previous content and then try some LyZ commands and see if you trigger any errors.
  2. You can look through the SQLite database and see if its contents makes sense. The sqlite-manager Firefox addon is one option for looking through the database: https://code.google.com/p/sqlite-manager/
  3. If you have all of the references for your document tagged or saved in a Zotero folder, you could try copying you LyX files to somewhere else and then selecting all of your references in Zotero and doing "Cite in LyX" to cite all of them at once and create a new BibTeX file for the copied LyX files. All of the BibTeX labels should be the same so this BibTeX file should still work with your existing document (delete the citation that you just added containing every reference). Does recreating the BibTeX file this way get back to the state before the problem? Or does "Update BibTeX" still not work?
dpprdan commented 10 years ago

Thanks for the extensive reply, Wills! So, the Zotero data directory. Well, I guess that was just too obvious for me. :) Well, I did have a look at the lyz.sqlite and I found the error! There was one record in the 'keys' table that did not have a 'key'-value nor a 'zid'. Just an 'id' and a 'bib' value. I discovered that merely by chance. I deleted that record, and voilá, updating BibTeX works again. Maybe the browser console would have issued an error as well, but I did not check. So thanks again, all is well!

wshanks commented 10 years ago

Great! I'm glad that fixed your issue and sheds a little more light on what the cause of the problem might be.

Tobelix commented 8 years ago

Hi, got the same problem (can not update the .bib file) i looked at the firefox browser console and get the error: Parameter 0 is undefined in Zotero.DB.getStatement() [QUERY: SELECT ROWID FROM items WHERE libraryID IS NULL AND key=?] db.js:324:0 uncaught exception: Parameter 0 is undefined in Zotero.DB.getStatement() [QUERY: SELECT ROWID FROM items WHERE libraryID IS NULL AND key=?]

Further i checked my sqlite file but i cannot find any unwritten cells. Is there another possibility which causes this problem?