jonathansick / ads_bibdesk

(Unmaintained) Mac OS X service for frictionless import of NASA ADS and arXiv publications into BibDesk.
GNU General Public License v3.0
37 stars 20 forks source link

ADSBibDesk doesn't work on macOS Mojave #74

Open maxwelltsai opened 6 years ago

maxwelltsai commented 6 years ago

Recently, after upgrading my Mac to Mojave, the package doesn't work anymore. The error message is:

Traceback (most recent call last):
  File "/usr/local/bin/adsbibdesk", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/site-packages/adsbibdesk.py", line 189, in main
    process_articles(args, prefs)
  File "/usr/local/lib/python2.7/site-packages/adsbibdesk.py", line 205, in process_articles
    bibdesk = BibDesk()
  File "/usr/local/lib/python2.7/site-packages/adsbibdesk.py", line 928, in __init__
    self.refresh()
  File "/usr/local/lib/python2.7/site-packages/adsbibdesk.py", line 961, in refresh
    self.titles = self('return title of publications', strlist=True)
  File "/usr/local/lib/python2.7/site-packages/adsbibdesk.py", line 952, in __call__
    for i in range(output.numberOfItems())]
AttributeError: 'NoneType' object has no attribute 'numberOfItems'

After some debugging, I came to realize that the attribute output becomes None due to the new privacy policy implemented in the macOS Mojave:

(None, {
    NSAppleScriptErrorAppName = BibDesk;
    NSAppleScriptErrorBriefMessage = "Not authorized to send Apple events to BibDesk.";
    NSAppleScriptErrorMessage = "Not authorized to send Apple events to BibDesk.";
    NSAppleScriptErrorNumber = "-1743";
    NSAppleScriptErrorRange = "NSRange: {78, 17}";
})
(None, {
    NSAppleScriptErrorAppName = BibDesk;
    NSAppleScriptErrorBriefMessage = "Not authorized to send Apple events to BibDesk.";
    NSAppleScriptErrorMessage = "Not authorized to send Apple events to BibDesk.";
    NSAppleScriptErrorNumber = "-1743";
    NSAppleScriptErrorRange = "NSRange: {55, 5}";
})

As you could notice, the error message is "Not authorized to send Apple events to BibDesk". I tried to let the OS bypass the privacy protection of BibDesk, but in there is no such a setting in the System Preferences | Privacy.

Any idea?

Thanks, Maxwell

keflavich commented 6 years ago

Unfortunately, I have no idea what to do about this; I'm on a much older version of Mac OS. I hope someone else can chime in with a fix.

fxt44 commented 6 years ago

i had the same problem. for me, reinstalling and then running the command line version fixed the command line version. automator workflow version not yet working for me.

fxt

fxt44 commented 6 years ago

update: a reboot got the automator workflow running.

so for me, the following gets it working on mojave:

1) reinstall. that is, % sudo python setup.py install

2) run the command line version on a paper % adsbibdesk 1998ApJ...500..525S finder will open a dialog box asking for permissions

3) reinstall the automator workflow double click build/Add to BibDesk.workflow

4) reboot

fxt

maxwelltsai commented 6 years ago

@fxt44 Thanks. I tried your procedure, but it still doesn't work. I cloned the latest version of adsbibdesk and try both

python setup.py install (i.e. install without root permission)

and

sudo python setup.py install (i.e. install with root permission)

But when I launch adsbibdesk from the command line, it yields the following error:

Starting ADS to BibDesk
Traceback (most recent call last):
  File "/usr/local/bin/adsbibdesk", line 11, in <module>
    load_entry_point('adsbibdesk==3.2.0', 'console_scripts', 'adsbibdesk')()
  File "/Volumes/RamDisk/ads_bibdesk/adsbibdesk.py", line 226, in main
    process_articles(args, prefs)
  File "/Volumes/RamDisk/ads_bibdesk/adsbibdesk.py", line 242, in process_articles
    bibdesk = BibDesk()
  File "/Volumes/RamDisk/ads_bibdesk/adsbibdesk.py", line 1013, in __init__
    self.refresh()
  File "/Volumes/RamDisk/ads_bibdesk/adsbibdesk.py", line 1045, in refresh
    self.titles = self('return title of publications', strlist=True)
  File "/Volumes/RamDisk/ads_bibdesk/adsbibdesk.py", line 1036, in __call__
    for i in range(output.numberOfItems())]
AttributeError: 'NoneType' object has no attribute 'numberOfItems'

There is no window popping up asking for permission. This error resemble the previous error message that I have posted earlier when I have an older version of adsbibdesk. Since the Python workflow doesn't work, the Automator that relies on the Python script also doesn't work.

fxt44 commented 6 years ago

ok. all i can say is that it worked for me. i am operating adsbibdesk as i usually do under mojave. as a double check, i just one by command line and one by a hotkey service on a selected ads bibstem.

i used the apple supplied python for the install as opposed to a python installed by macports, homebrew, etc.

fxt

maxwelltsai commented 6 years ago

@fxt44: Thanks. I tried again using exclusively the system python /usr/bin/python but still doesn't work...

fxt44 commented 6 years ago

i got serious about adding a few hundred papers to bibdesk. i'm finding some get added and some don't via the command line. to me, there is no obvious pattern.

adsbibdesk is showing bit rot as abandonware and may drop dead when old ads is turned off. unfortunately i have neither the python skills nor the time to invest in keeping this valuable tool alive.

fxt

keflavich commented 6 years ago

fxt, that's not very helpful criticism. If you can find a pattern, please post it, and we can look into it. It's possible your failures were related to server-side errors.

This package is being partly maintained. We need to have a solution to the API key issue, in which users need their own API key to use the new ADS API, before we can try to switch to that. Refactoring to use the new ADS API shouldn't be terribly difficult, but it does require significant effort. If and when ADS decides to fully deprecate their current system (it's not entirely clear that they will, though the backend will certainly be shut down eventually), I'll at least try to port ads_bibdesk over.

fxt44 commented 6 years ago

hi adam,

not very helpful criticism.

au contraire! the aim of a well-crafted critique, be it on a discussion board or otherwise, is to elicit a positive and informative response. your reply is rich in both: 1) someone beyond users is listening; 2) adsbibdesk is being partially maintained; 3) the forthcoming transition to new ads is at least being examined. this is all happy news that i wasn't able to glean from perusing this repo.

there is information with respect to my observation of no obvious pattern, albeit maybe not the most valuable. i pretty much eliminated a server-side cause, as a bibstem or doi that could not be added was repeatable. yet sandwiched between failures, i could fire a different bibstem or doi that would be added. i could aggregate a list of the bibstem/doi that are being resistant for me.

fxt

keflavich commented 6 years ago

@fxt44 A list of failed bibstems/dois would be helpful. However, if you come up with that, could you please post it in a different Issue? I suspect your failures are unrelated to Mac OS X issues.

ttshimiz commented 6 years ago

@fxt44: Thanks. I tried again using exclusively the system python /usr/bin/python but still doesn't work...

Hi @maxwelltsai, I have been having the same issue as you and finally got it to work. One thing I needed to do was to clear out all of my permissions for Apple Events using the following command: tccutil reset AppleEvents

After doing this and reinstalling adsbibdesk using the system python, both the CLI and the automator workflow worked fine although I also had to install manually the requests module as well as update my terminal application (iTerm).

fxt44 commented 6 years ago

hi ttshimiz,

nice work! can you detail a bit more on what you mean by "install manually the requests module"?

fxt