PKM-er / obsidian-zotlit

A third-party project that aims to facilitate the integration between Obsidian.md and Zotero, by providing a set of community plugins for both Obsidian and Zotero.
https://zotlit.aidenlx.top
MIT License
632 stars 28 forks source link

Failed to load Better BibTex #236

Closed ZhengJIN94 closed 10 months ago

ZhengJIN94 commented 10 months ago

Hi,

After I installed ZotLit, there is an error as follow figure

image

I am sure the better-bibtex-search.sqlite is in that directory.

Another issue is that when I use [@ to cite literature, it return back as [@undefined].

It there any way to solve these two problems?

retorquere commented 10 months ago

The citation keys have moved. They live in better-bibtex.sqlite now, that database must be mounted using

ATTACH DATABASE '<path to better-bibtex.sqlite>' AS betterbibtex

after which the citation keys can be read from betterbibtex.citationkey.

retorquere commented 10 months ago

I tried to prepare a PR but I don't understand the source code of this plugin.

aidenlx commented 10 months ago

Noted, will update shortly

aidenlx commented 10 months ago

@retorquere could you provide the version of the better bibtex?

retorquere commented 10 months ago

6.7.132 or later.

benpla commented 10 months ago

I have a similar effect (noted here for clarifying): It differs in Zotero items created before the update and Zotero items created now.

OLD Zotero Items: On "Create Literature Note" all is fine: citekey is specified correctly.

NEW Zotero Items (added after update): citekey first looks like it always does in Zotero, but On "Create Literature Note" citekey are "undefined".

grafik

Note: If I change an old Citekey and "Create Literature Note", then the change take not into account and the old key is exported.

BibTeX: 6.7.132 Obsidian Note for Zotero: 1.0.1

retorquere commented 10 months ago

That's because I have left the old database in place, it's an easy fallback scenario because database changes are the scariest of changes. But that backup is no longer being updated, so zotlit will have to be updated. This PR fixed it for another project, but I do not understand the composition of zotlit.

JacobHamelMottiez commented 10 months ago

I have the same problem as @benpla with citation key of newly added references in Zotero! Thanks @retorquere and @aidenlx for your great work, I am really enjoying both your plugins and I hope this issue will be resolved soon!

retorquere commented 10 months ago

I'll be glad to help when @PKM-er works on it, but I don't understand how this plugin hangs together.

alephpiece commented 10 months ago

I have to roll back to Better BibTeX 6.7.130 to make this plugin work.

retorquere commented 10 months ago

Which will be undone by Zotero in the next 48 hours. This is not a sustainable workaround.

retorquere commented 10 months ago

And if you roll back (with all the risk that entails - no support, and when you upgrade back to the regular release, any new citekeys and auto exports you make will be lost during the upgrade), please roll back to 124, not 130.

luyanze commented 10 months ago

I use Better BibTeX 6.7.133 and Obsidian Note for Zotero: 1.0.1, and meet the same problems. Roll back is a useful way to temporary solve these problem.

alephpiece commented 10 months ago

Which will be undone by Zotero in the next 48 hours. This is not a sustainable workaround.

I just turned off automatic updates for Better BibTeX. Hope it works.

retorquere commented 10 months ago

Still recommend 124 over 130

retorquere commented 10 months ago

Just as a reminder then: when you go back to the regular release of BBT, some keys might be regenerated, and some auto exports may be lost.

Also please do install the latest BBT release before opening new issues.

mariomui commented 10 months ago

I tried to prepare a PR but I don't understand the source code of this plugin.

Part of this plugin uses ophidian core which connects this.current to the SettingsPluginClass.

https://github.com/PKM-er/obsidian-zotlit/blob/dcd41794fd96f92c1866e870821aeb128507b339/app/obsidian/src/services/zotero-db/connector/settings.ts#L9

So here's where the zoterodatadir is being set, and once it is set, that data is being automatically cloned by ophidian core into this.current

P.S. https://github.com/ophidian-lib/core/blob/c5c701558192b9c64a628dce69779ca4e8d98c41/src/plugin-settings.ts#L71 here's the code where ophidian core clones the SettingsTab data into this.current

retorquere commented 10 months ago

That's fine, but I'm not diving into the details of obsidian plugin building, so I'm not going to prepare a PR. If someone who knows how this plugin is put together is willing to make the PR, I can say exactly what must be changed in the database access.

mariomui commented 10 months ago

That's fine, but I'm not diving into the details of obsidian plugin building, so I'm not going to prepare a PR. If someone who knows how this plugin is put together is willing to make the PR, I can say exactly what must be changed in the database access.

i would do it but i just effed up my zotero database across google drive across all my computers. i'm in a process of recovering my data and am loathe to burn my eyes out on the black sun of self inflicted pain again. (be happy to hear how you folks test zotero integration tho')

https://github.com/PKM-er/obsidian-zotlit/blob/dcd41794fd96f92c1866e870821aeb128507b339/app/obsidian/src/settings/base.ts#L58C35-L58C35

i mean is it as simple as just changing this?

retorquere commented 10 months ago

I only see stuff there about paths. I don't see where the connection is made, or where the database is queried.

But if you're willing to make the PR, the change is that instead of connecting directly to better-bibtex.sqlite, you must connect to any other database (:memory: would work) and then attach the bbt database using

ATTACH ? AS betterbibtex

where the parameter is the full path to better-bibtex.slqite. After this you can query betterbibtex.citekey.

retorquere commented 10 months ago

Oh I see you're fighting with your data right now. That takes precedence of course. Did you sync with the zotero servers? That's easier to restore from.

retorquere commented 10 months ago

I test zotero integration with selenium to set up a prepared profile specifically for the test run, then I drive zotero using a separate plugin called the debug bridge. Does that answer your question? This profile is separate from my "working" profile, my tests don't touch that.

aidenlx commented 10 months ago

should be fixed in v1.1.3

anandkumar89 commented 8 months ago
Screenshot 2023-12-12 at 10 30 46 AM

Logs in console

Screenshot 2023-12-12 at 10 35 05 AM Screenshot 2023-12-12 at 10 35 24 AM

Still facing this issue.

anandkumar89 commented 8 months ago

Solution : Updating zotero to V7 and betterbibtex plugin also resolved the issue.

yuhanyao commented 7 months ago

restart obsidian can also solve the problem