Doesn't work on MacOS Sequoia 15.3.2
When I run /Users/User1/Documents/notifwd/notifwd.py --api-key <mykey> -s -f 40, I get below error:
File "/Users/User1/Documents/notifwd/notifwd2.py", line 207, in <module>
Notification.main(argv)
~~~~~~~~~~~~~~~~~^^^^^^
File "/Users/User1/Documents/notifwd/notifwd2.py", line 84, in main
Notification.setup(argv)
~~~~~~~~~~~~~~~~~~^^^^^^
File "/Users/User1/Documents/notifwd/notifwd2.py", line 73, in setup
last_data = Notification.get_notification_data(0)
File "/Users/User1/Documents/notifwd/notifwd2.py", line 124, in get_notification_data
return Notification.cursor.execute("SELECT * FROM (SELECT * FROM record ORDER BY rec_id DESC LIMIT %d) ORDER BY rec_id LIMIT 1" % (n + 1)).fetchone()
~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sqlite3.OperationalError: no such table: record
It was working before the OS upgrade.
Maybe relevant: https://9to5mac.com/2024/09/01/security-bite-apple-addresses-privacy-concerns-around-notification-center-database-in-macos-sequoia/
I changed the DB path to:
db_path = Path.home() / "Library/Group Containers/group.com.apple.usernoted/db2/db"
Notification.connection = sqlite3.connect(db_path)
Notification.cursor = Notification.connection.cursor()
it works fine now and you'll also need to grant full disk access for the terminal/iterm from OSX Security & privacy settings.
Just wanted to chime in to whoever finds this next who might not be able to connect the dots, this fix worked for me but required that I import the pathlib package at the top of the file like so:
from pathlib import Path