I want to send a notification to my mac's notification center with python code.
I'm using python3 on macOS Mojave version 10.14.6 with Atom as my editor. I've tried using different methods, like notify2 (which didn't work, there was a problem with dbus which I couldn't solve) and notify-send (which replied RuntimeError: Unsupported operating system: darwin). So, now, I'm trying to use the OS module. This is my code so far:
import os
mstr='Hello'
os.system('notify-send '+mstr)
When I run it from terminal, it outputs sh: notify-send: command not found. If I run it from IDLE, Python's default editor, nothing happens.
What do I do? Are there other alternatives to send notifications?
Sorry! I found a fix for this after going around the web. Here it is!
import os
mstr='Hello'
os.system("osascript -e 'display notification \"hello world!\"\'")```
One of the alternatives is the macos-notifcations. Check it out :)
Disclaimer: I am the creator of macos-notifications.
A short example for you of the functionality it has:

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With