Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using iPython Notebook on OSX Yosemite to test pyatom - <atomac.AXClasses.NativeUIElement <No role!> ''> #132

Open
ericvalente opened this issue Aug 20, 2015 · 8 comments

Comments

@ericvalente
Copy link

I am getting this error when I try to run atomac.getAppRefByBundleId('net.app.app'):
<atomac.AXClasses.NativeUIElement <No role!> ''>

I believe it is because of Yosemite's OSX Accessibility settings/permissions. I tried adding Chrome and terminal to the "Allow the apps to control your computer" section of Security & Privacy but no luck.

Anyone know which application I need to approve in order to get iPython Notebook to work?

@SudheerVusa
Copy link

I'm also seeing the same issue when i run the script from the remote terminal using plink, but not when i ran it locally.

@ericcastro
Copy link

Also getting this in El Capitan......... it was working fine in Yosemite

@ericcastro
Copy link

Ok got it fixed by adding Terminal (or iTerm, the one I use) to the Accesibility app list. I forgot about that

@SharonAndroid
Copy link

SharonAndroid commented Aug 6, 2016

Even I have added my app to the Accessibility app list, I still met this issue:
atomac.launchAppByBundleId('com.apple.Automator')
automator2 = atomac.getAppRefByBundleId('com.apple.Automator')
print automator2

<atomac.AXClasses.NativeUIElement <No role!> ''>
I'm using Mac OS 10.11.6, is it not supported? Thanks

@greaterking
Copy link

greaterking commented Jan 17, 2017

If you were using an embedded terminal of an application other than "Terminal.app" you have to add that to accessibility as well. I was using Coda2 and not everything works.

@SharonAndroid
Copy link

SharonAndroid commented May 4, 2017 via email

@greaterking
Copy link

No problem :D

@jcushman
Copy link

The cleanest way to handle this is to check for accessibility permissions in your script, and prompt the user to grant permissions if they're not found:

def request_accessibility_permission():
    b = objc.loadBundle('CoreServices', globals(), '/System/Library/Frameworks/ApplicationServices.framework')
    objc.loadBundleFunctions(b, globals(), [('AXIsProcessTrustedWithOptions', b'Z@')])
    objc.loadBundleVariables(b, globals(), [('kAXTrustedCheckOptionPrompt', b'@')])
    return AXIsProcessTrustedWithOptions({kAXTrustedCheckOptionPrompt: True})

if not request_accessibility_permission():
    print("Run me again after you've granted permissions")

This will pop up an OS dialog box to open settings and grant permissions to the appropriate app. Objc code is via the pyobjc mailing list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants