Python sqlite3 access db denied
Hi!
I am using a python script to fetch information in zotero.sqlite while being offline (so Pyzotero doesn't work) and also while zotero is open.
I use sqlite3 to connect directly to zotero.sqlite but then I get this error: "sqlite3.OperationalError: database is locked"
If I close zotero then my script works but I really need to have zotero how when my script runs so close zotero isn't an option. How idea how I can solve this?
Thanks a lot
I am using a python script to fetch information in zotero.sqlite while being offline (so Pyzotero doesn't work) and also while zotero is open.
I use sqlite3 to connect directly to zotero.sqlite but then I get this error: "sqlite3.OperationalError: database is locked"
If I close zotero then my script works but I really need to have zotero how when my script runs so close zotero isn't an option. How idea how I can solve this?
Thanks a lot
Here is what I want to do: when I read a pdf that is stored in zotero (it attached under an item), I want to be able to select a sentence, trigger a python script that copies this sentence and append to it an HTML link like source (where ABCD1234 is the key under whihc the pdf I read is referenced and 99 is the page where the copied sentence is written). I can then paste everything in a zotero note and next time I read this I can simply click on the link and it will open the correct pdf to the correct page.
So I need to get into the zotero.sqlite to get the correct key (in my example ABCD1234).
So far my work around is to copy zotero.sqlite (in a temp folder). Then my script connects to this zotero -copy.sqlite. But it is slow (my .sqlite is heavy).
sqlite doesn't allow simultaneous read/write access (writing requires an exclusive lock on the db) and some version of local caching/copying is the only way to go.
So it seems I don't have a choice: I must copy the .sqlite and delete this copy each time I need to access a pdf key.
I wonder if Zotfile could be modified so that it can be trigger with a shortcut (I use autohotkey for my python script) even when reading a pdf on Acrobat reader and once zotfile is triggered with this shortcut, it retrieves only the last highlight.