3

When an error/exception (such as a NameError because I typo'd a variable name) occurs in notification_filter -- the error/exception information doesn't appear to be propagated (or is caught silently).

A simple example:

import dbus
from dbus.mainloop.glib import DBusGMainLoop
from gi.repository import GLib

def notification_filter(bus, message):
    raise Exception("This exception is never propagated/printed")

if __name__ == "__main__":        
    DBusGMainLoop(set_as_default=True)

    bus = dbus.SessionBus()
    bus.add_match_string_non_blocking("eavesdrop=true, interface='org.freedesktop.Notifications', member='Notify'")
    bus.add_message_filter(notification_filter)

    mainloop = GLib.MainLoop()
    mainloop.run()

How can I print/log information when an error/exception occurs?

  • 1
    Does this answer your question? [PyGObject GLib.MainLoop() and exceptions](https://stackoverflow.com/questions/54666827/pygobject-glib-mainloop-and-exceptions) – Philip Withnall Apr 15 '20 at 08:27
  • 1
    Unfortunately, no. The answer for that post states that the exception is "caught and printed", but no printing occurs with my code, which is the issue I want to address. – plasmaproof Apr 16 '20 at 04:38
  • @plasmaproof did you ever find a fix for this? I'm having the same issue. – DaV Apr 13 '23 at 12:25

0 Answers0