'why does pync .notify for mac not work? (python)

I'm trying to do notifications in python on mac. I have installed pync, and used the following code:

from plyer import notification
import pync, time

while True:
    pync.notify("lets do something random!")
    print("Activated!")
    time.sleep(1)

The visual studio code debugger shows this:

Activated!
Activated!
Activated!

However, no notification shows up. I have enabled notifications, with banner and sounds. Why does the notification not display? Thanks in advance!



Solution 1:[1]

Yes, it works for me on MacOS 12.3.1

Make sure you have notification from terminal-notifier allowed:

System Preferences -> Notifications & Focus -> terminal-notifier and allow the notifications

Also, it might be the case that you have notifications disabled on your mac e.g. you're in "focus" mode

screenshot of settings

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1