[xubuntu-users] Problems with sending Notifications from Python

Christoph Robbert chrobbert at gmail.com
Sat Oct 4 11:32:13 UTC 2014

Am 02.10.2014 um 21:02 schrieb Steve Litt:
> On Thu, 02 Oct 2014 12:37:21 +0200
> Christoph Robbert <chrobbert at gmail.com> wrote:
>> Hey,
>> I want to write a small python script which uses the xfce4-notifyd
>> service. It sends a notification at the beginning and after some time
>> (in my case 25 Minutes) a second one. Unfortunately I get the
>> following error message when sending the second notification.
>> gi._glib.GError:
>> GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The
>> name :1.118 was not provided by any .service files
> [snip Python specifics]
> Make sure you've installed libnotify4 and libnotify-bin (the executable
> command line utilities for libnotify).
> Also, since you want to access libnotify from Python, install
> python-notify.
> [NOTE: These are the package names in Debian Wheezy. They might be
> slightly different in Ubuntu]
> Now perform the following command as a normal user:
> notify-send "This is a test"
> If the preceding fails to bring up a notification, you have more
> fundamental problems than your Python bindings.
> Also,
> ps ax | grep notify
> See what is and is not used as a notification daemon.
> Just for fun, you might want to switch xfce4-notifyd for dunst, or vice
> versa, and view the results.
> Once notification is working from notify-send, you're in a better
> position to debug your Python program.
> HTH,
> SteveT
> Steve Litt                *  http://www.troubleshooters.com/
> Troubleshooting Training  *  Human Performance

maybe my first post was a bit misleading. I have installed the 
xfce4-notifyd program and also the python-notify, libnotify4, and 
libnotify-bin libraries. The output of ps ax | grep notify is:

ps ax | grep notify
    30 ?        S      0:00 [fsnotify_mark]
  3110 ?        S      0:00 /usr/lib/xfce4/notifyd/xfce4-notifyd
  7011 pts/2    S+     0:00 grep --color=auto notify

I'm able to create notification which show up, when sending them from 
the commandline via notify-send. Furthermore I'm able to create this 
notification from within python. Either via the python-notify binding or 
via the python-gobject bindings (which is used in the snipped). So far 
so good. But with both python bindings I get the above error, when 
sending the second notification if I wait 25 Minutes between these both 
messages. The first notification shows up as intended but instead of the 
second one I get the following Traceback:

Traceback (most recent call last):
   File "test.py", line 18, in <module>
     send_notification("test", "second")
   File "test.py", line 11, in send_notification
   File "/usr/lib/python2.7/dist-packages/gi/types.py", line 43, in function
     return info.invoke(*args, **kwargs)
gi._glib.GError: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: 
The name :1.91 was not provided by any .service files

A college tested the above python snipped on his Arch/Gnome3 box and it 
runs as intended. It shows both messages.

Thanks for your tip with dunst. I will check it out.

Christoph Robbert

More information about the xubuntu-users mailing list