i'm new on python and pynotify i want to create a notify message that shows me a notification with python and pynotify but i have a problem, all examples i use on tutorials found on internet.
ex.
#!/usr/bin/python
import sys
import pynotify
if __name__ == "__main__":
if not pynotify.init("icon-summary-body"):
sys.exit(1)
n = pynotify.Notification(
"Hi There",
"welcome to stackoverflow!",
##dont remove the below line
"notification-message-im")
n.show()
or
#!/usr/bin/env python
import os
import pynotify
pynotify.init("random information")
s = os.popen("fortune -n 100 -s","r").read()
n = pynotify.Notification("Fortune",s)
n.show()
gives me always the same error
** (icmp.py:13188): WARNING **: Connection Closed
Traceback (most recent call last):
File "icmp.py", line 14, in <module>
n.show()
gio.Error: Connection Closed
What does it mean??
Thanks
To me the only way for now to use notification while using sudo python is by calling notify-send with subprocess:
Desktop environment: xfce4
There you go! In my case this problem is the result of the tight security in Arch based distros as debian base distros are more flexible or actually insecure. Because this is more like a hack and it uses "shell=True" it's not recommended.