[Tutor] Desktop Notifications on Linux
dharmit.dev at gmail.com
Thu Apr 10 09:39:18 CEST 2014
I am trying to create a script that will go through the
/var/log/secure file on a Linux system and provide desktop
notifications for failed login attempts.
Here is the code - http://pastebin.com/MXP8Yd91
And here's notification.py - http://pastebin.com/BhsSTP6H
I am facing issue in the function "new_attempts_from_last". I am not
able to raise a desktop notification from this function. It always
fails with this traceback - http://pastebin.com/cgHMScv3
I see this error only when I try to raise a notification from the
aforementioned function. If I run test examples under
/usr/share/doc/notify-python/examples, it works just fine. Also, if I
try to raise a notification from under if __name__ == "__main__":, it
works without any issues. So I don't think there's any issue with OS's
notification daemon. Running from python shell like below also works
In : import notification
In : notification.notification("Hey")
What am I missing or doing wrong here?
If it matters, I am running Fedora 20, python 2.7 and Cinnamon desktop
For readability purposes, I have provided pastebin links. Let me know
if this is not the correct way.
More information about the Tutor