matryer / xbar

Put the output from any script or program into your macOS Menu Bar (the BitBar reboot)
https://xbarapp.com
MIT License
17.45k stars 641 forks source link

Not authorized to send Apple events in Python script #681

Open ZBiener opened 3 years ago

ZBiener commented 3 years ago

I have a python script that calls an applescript using py-applescript (https://github.com/rdhyee/py-applescript). That applescript queries OmniFocus for a variety of data.

The python script runs from the command line with no problem.

However, from xbar, it generates the following error (with some fluff truncated): "

exit status 1: Traceback (most recent call last): ... ... File "....pyenv/versions/3.8.1/lib/python3.8/site-packages/py_applescript-1.0.1-py3.8.egg/applescript/init..py", line 90, in run File "....pyenv/versions/3.8.1/lib/python3.8/site-packages/py_applescript-1.0.1-py3.8.egg/applescript/init..py", line 65, in _unpackresult applescript.ScriptError: Not authorized to send Apple events to OmniFocus. (-1743) app='OmniFocus' range=140-191

I've checked the Security preferences pane, to make sure that the xbar has all possible automation privileges. Right now, the only checkboxes available under xbar are "Audirvana.app" and "System Events.app" (both of which I expect to be there). I also call Audirvana using applescript, but that applescript is embedded in a bash script, not a python script that uses py-applescript.

It seems like some permissions are not being granted 'through' xbar and python, but since the script runs OK from the command line, I don't really know how to troubleshoot further. Ideas?

Thanks.

matryer commented 3 years ago

@ZBiener thanks for reporting this. @leaanthony looks like we need to look into entitlements etc.

leaanthony commented 3 years ago

It looks like we need to get code signing working to allow this.

ZBiener commented 2 years ago

Code signing seems to have been taken care of (right?), but I still get the same errors. Are there any other suggestions for where I might look to solve this? Thanks. (FWIW, the old BitBar does not generate the same errors).

leaanthony commented 2 years ago

I'll put this on my todo @ZBiener