Database is locked
I meet some error, I cannot search the paper in the zotero
10:33:21 workflow.py:2080 ERROR database is locked Traceback (most recent call last): File "./lib/workflow/workflow.py", line 2073, in run func(self) File "./zh", line 714, in main return do_reindex() File "./zh", line 597, in do_reindex app.update_index(force=False) File "./lib/zothero/core.py", line 166, in update_index self.index.update(self.zotero, force) File "./lib/zothero/index.py", line 277, in update if not self._update(zot, force): File "./lib/zothero/index.py", line 325, in _update for e in it: File "./lib/zothero/zotero.py", line 268, in all_entries yield self._load_entry(row) File "./lib/zothero/zotero.py", line 320, in load_entry e.citekey = self.bbt.citekey('{}{}'.format(e.library, e.key)) File "./lib/zothero/zotero.py", line 195, in bbt self._bbt = BetterBibTex(self.datadir) File "./lib/zothero/betterbibtex.py", line 48, in init row = conn.execute(SQL).fetchone() OperationalError: database is locked 10:33:22 workflow.py:2082 INFO for assistance, see: https://github.com/deanishe/zothero/issues
It is work now, just reopen Zotero!
Thanks for finding the bug. I did wonder why this error wasn't occurring. The workflow makes a copy of Zotero's own database to avoid exactly this problem, but the BetterBibTex feature doesn't.
Perhaps @yarray would be interested in submitting a fix.
@deanishe The Betterbibtex plugin seems not to lock the database unless it needs to perform actions like updating the citekeys. Nevertheless, it should be better to copy the database first to avoid the lock. I may take some time to investigate the proper strategy in the next days.
The Betterbibtex plugin seems not to lock the database unless it needs to perform actions
Same is true of Zotero, IIRC, but you still run into problems.
I may take some time to investigate the proper strategy in the next days.
The same way the rest of the workflow works. I already changed your PR to fix bugs and cache the BBT keys along with the rest of the data because reading the entire database on every paste is a slow way to do things. The update code just needs altering to make a copy of the database and read that.
I'm also having this issue. Currently can't use Zothero. I also have BBT installed and am getting the "library is locked" error- zothero is stuck on "Initializing Search Index"
I just wanted to provide an updated that zothero started working again (after a few attempts to restart/refresh zothero and zotero and checking plugins). I am no longer stuck on "Initializing Search Index." Hopefully this might help anyone else who may run into this.
I've been having this issue for a while now and while the issue will somehow resolve itself after a while, a simple restart of zotero does not reliably do the trick. Since it appears @deanishe has an idea how to potentially fix this, I was wondering if you or @yarray had time to do this? It would be great to be able to refresh zothero after I added new references to zotero.
It is still a problem :( Using zotfile and BBT
What worked for me, was
- deactivating BBT in Zotero -> Tools -> Addons.
- Restart Zotero
- Reindex ZotHero
- Reenable BBT and restart Zotero
This did not work for me unfortunately :(
@eppfel Did this work for you longer term or is it merely a one-time fix that you have to repeat again and again?
I just had the problem again, checked for help in this issue tracker and found my own comment with the solution that I had totally forgotten. 🤣
So, it works longer term, as I did not have the error since a couple months.
omg @eppfel thank you so much for the suggested solution, worked right away for me !