JabRef / JabRef-Browser-Extension

Browser extension for JabRef to allow importing of new items directly from the browser.
https://www.jabref.org/
GNU Affero General Public License v3.0
83 stars 22 forks source link

OS X, Edge: Error while sending to JabRef. Please see the browsers error console for details. #390

Open bhatiaa opened 2 years ago

bhatiaa commented 2 years ago

Hi, I am trying to use the JabRef Extension for Edge Beta browser on OS X, and I keep getting the following error across multiple sites (Google Scholar, PubMed, etc.).

Error while sending to JabRef. Please see the browsers error console for details.

I opened the Developer Console and I have the following message: image

Edge browser version: Version 97.0.1072.41 (Official build) Beta (x86_64) OS version: Mac OS Monterey, 12.0.1 Jabref version: JabRef 5.4--2021-12-20--ab44182 Mac OS X 10.16 x86_64 Java 16.0.2 JavaFX 17.0.1+1

I tried following the instructions from here, https://docs.jabref.org/collect/jabref-browser-extension, but I do not have the folders /Library/Microsoft/Edge/NativeMessagingHosts/, ~/Library/Application Support/Microsoft Edge {Beta}/NativeMessagingHosts/.

When I type the python command, I get the following error. python /Applications/JabRef.app/Contents/Resources/jabrefHost.py Traceback (most recent call last): File "/Applications/JabRef.app/Contents/Resources/jabrefHost.py", line 11, in from pathlib import Path ImportError: No module named pathlib

tobiasdiez commented 2 years ago

but I do not have the folders /Library/Microsoft/Edge/NativeMessagingHosts/, ~/Library/Application Support/Microsoft Edge {Beta}/NativeMessagingHosts/.

Then please create them and otherwise follow the documentation. @LyzardKing can we install the manifest automatically as for the other browsers?

ImportError: No module named pathlib

Looks like you still use an old version of Python. Could you please make sure that Python 3 is used by default, then it should work. @LyzardKing should we change the shebang to use python3?

bhatiaa commented 2 years ago

Thanks for all the help - I followed the instructions and placed org.jabref.jabref.json in the folder ~/Library/Application Support/Microsoft Edge Beta/NativeMessagingHosts/.

I tried again, the same error message pops up - "Error while sending to JabRef. Please see the browsers error console for details." There are no errors on the Developer console. I am guessing that the requirement to have python as version 3 may be causing the problem. On OSX, python2 still seems to be the system default. Python3 is installed on my machine (e.g., python3 --version returns Python 3.8.2), but I am hesitant to force a system-wide change of Python to Python3 as many system libraries may still be dependent on Python2 (I am aware that Python2 has been EOL for a long while now). Is there another possible workaround that may make the whole integration work? I installed via dmg installer.

I also looked at the script /Applications/JabRef.app/Contents/Resources/jabrefHost.py and the shebang line already points to python3 location where python3 is indeed available, which python3 /usr/bin/python3.

LyzardKing commented 2 years ago

I believe it is already be set to python3. Regarding the manifest, we set the .pkg installer to automatically copy those files to the correct locations, although they cannot be removed automatically on uninstall. The .dmg cannot run install scripts. I was thinking that the copy could be done from the settings panel, so from JabRef itself, what do you think @tobiasdiez ?

tobiasdiez commented 2 years ago

I also looked at the script /Applications/JabRef.app/Contents/Resources/jabrefHost.py and the shebang line already points to python3 location where python3 is indeed available,

Ah, I should have looked it up. With the correct shebang, python3 should automatically be used by chrome to open the file. However, my command above explicitly referenced the standard python and hence overwrites the shebang. What should work is either calling python3 /Applications/JabRef.app/Contents/Resources/jabrefHost.py or just /Applications/JabRef.app/Contents/Resources/jabrefHost.py

I was thinking that the copy could be done from the settings panel, so from JabRef itself, what do you think @tobiasdiez ?

I like this idea. One could automatically detect which browsers are installed, and then offer to install the necessary files and/or check if everything is configured correctly. However, does JabRef has normally the necessary rights to write files in the correct locations?

LyzardKing commented 2 years ago

I'm not sure about the macos specific permissions, but if we install in the user home folder (so not system wide) it should work. The same could be done for the linux version. I've been thinking about this for a while now. Unfortunately I don't have too much time, but it would be a lot more user friendly, and common to the different OS versions. If the system can detect the installed browsers it can highlight them in a list. Although an issue might arise with confined versions of jabref (or of the browsers), since they would not be visible. So I would leave the possibility of selecting manually from a list of browsers.

Something like: These are the browsers identified: Firefox, Chrome These are all the supported browsers: Firefox, Chrome, Safari, Edge

tobiasdiez commented 2 years ago

Good points, I've opened https://github.com/JabRef/jabref/issues/8400 to track this.