pythonpynotify

Python: pynotify network problem


I am using pynotify and this is the code I am trying to get to work:

#! /usr/bin/python
try:
    import pynotify
    if pynotify.init("Telebrama Alert"):
        n = pynotify.Notification('Message','This is test message')
        n.set_urgency(pynotify.URGENCY_CRITICAL)
        n.show()
    else:
        print 'There was a problem in initializing the pynotify module'
except:
    print "you don't seem to installed pynotify\n"

It is working fine on my computer. But I want to send some notification to another network. How can I make it work?


Solution

  • pynotify is just an X client. To connect non-local X server you have to set DISPLAY environment variable. Note, that X server you are going to connect to should be configured to accept remote connections (see man pages for xhost and xauth).