You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I expect that this is a rights problem, with code running in a launch item not having access to the AddressBook.
Have you tried bundling the script in an app bundle and run it that way. First time running should ask for permission (system dialog), after that running the main binary in the app bundle in a launch bundle will likely work.
python3 -c 'import AddressBook as ab; print(len(ab.ABAddressBook.sharedAddressBook().people()))' It doesn't show anything at all, just print me 2023-07-04 10:52:42.743 Python[79271:7603071] -[__NSCFString count]: unrecognized selector sent to instance 0x600003d25170 zsh: trace trap python3 -c
Describe the bug
Using pyobjc via
launchd
does not behave as expected.For example, normally
$ python3 -c 'import AddressBook as ab; print(len(ab.ABAddressBook.sharedAddressBook().people()))' 100
However, if the command is launched via
launchd
, thenab.ABAddressBook.sharedAddressBook()
returnsNone
.Platform information
To Reproduce
ab-example.sh
with the content here.chmod +x ab-example.sh
to make it executable.ab-example.plist
with the example content here. ReplaceYOUR_USER_HERE
by your username.launchctl load ~/ab-example.plist
launchctl start ab-example
In
ab-example.errors.log
you can seeExpected behavior
ab.ABAddressBook.sharedAddressBook()
does not returnNone
.Note, that this runs fine in the Terminal
$ /usr/local/bin/python3 -c 'import AddressBook as ab; print(len(ab.ABAddressBook.sharedAddressBook().people()))' 100
Additional context
pyobjc
.The text was updated successfully, but these errors were encountered: