from dbus.exceptions import DBusException
try:
    import gi
    gi.require_version('Notify', '0.7')
    from gi.repository import Notify
except (ImportError, AttributeError):
    from scudcloud import notify2
    Notify = None

class Notifier(object):

    def __init__(self, app_name, icon):
        self.icon = icon
        try:
            if Notify is not None:
                Notify.init(app_name)
                self.notifier = Notify
            else:
                notify2.init(app_name)
                self.notifier = notify2
            self.enabled = True
        except DBusException:
            print("WARNING: No notification daemon found! "
                  "Notifications will be ignored.")
            self.enabled = False

    def notify(self, title, message, icon=None):
        if not self.enabled:
            return
        if icon is None:
            icon = self.icon
        if Notify is not None:
            notice = self.notifier.Notification.new(title, message, icon)
        else:
            notice = notify2.Notification(title, message, icon)
        notice.set_hint_string('x-canonical-append', '')
        try:
            notice.show()
        except:
            pass

from dbus.exceptions import DBusException
try:
    import gi
    gi.require_version('Notify', '0.7')
    from gi.repository import Notify
except (ImportError, AttributeError, ValueError):
    from scudcloud import notify2
    Notify = None

class Notifier(object):

    def __init__(self, app_name, icon):
        self.icon = icon
        try:
            if Notify is not None:
                Notify.init(app_name)
                self.notifier = Notify
            else:
                notify2.init(app_name)
                self.notifier = notify2
            self.enabled = True
        except DBusException:
            print("WARNING: No notification daemon found! "
                  "Notifications will be ignored.")
            self.enabled = False

    def notify(self, title, message, icon=None):
        if not self.enabled:
            return
        if icon is None:
            icon = self.icon
        if Notify is not None:
            notice = self.notifier.Notification.new(title, message, icon)
        else:
            notice = notify2.Notification(title, message, icon)
        notice.set_hint_string('x-canonical-append', '')
        try:
            notice.show()
        except:
            pass

Allow ValueError as a notify exception
Allow ValueError as a notify exception

  from dbus.exceptions import DBusException
  try:
      import gi
      gi.require_version('Notify', '0.7')
      from gi.repository import Notify
- except (ImportError, AttributeError):
+ except (ImportError, AttributeError, ValueError):
      from scudcloud import notify2
      Notify = None
  
  class Notifier(object):
  
      def __init__(self, app_name, icon):
          self.icon = icon
          try:
              if Notify is not None:
                  Notify.init(app_name)
                  self.notifier = Notify
              else:
                  notify2.init(app_name)
                  self.notifier = notify2
              self.enabled = True
          except DBusException:
              print("WARNING: No notification daemon found! "
                    "Notifications will be ignored.")
              self.enabled = False
  
      def notify(self, title, message, icon=None):
          if not self.enabled:
              return
          if icon is None:
              icon = self.icon
          if Notify is not None:
              notice = self.notifier.Notification.new(title, message, icon)
          else:
              notice = notify2.Notification(title, message, icon)
          notice.set_hint_string('x-canonical-append', '')
          try:
              notice.show()
          except:
              pass
  
Allow ValueError as a notify exception
## Code Before:
from dbus.exceptions import DBusException
try:
    import gi
    gi.require_version('Notify', '0.7')
    from gi.repository import Notify
except (ImportError, AttributeError):
    from scudcloud import notify2
    Notify = None

class Notifier(object):

    def __init__(self, app_name, icon):
        self.icon = icon
        try:
            if Notify is not None:
                Notify.init(app_name)
                self.notifier = Notify
            else:
                notify2.init(app_name)
                self.notifier = notify2
            self.enabled = True
        except DBusException:
            print("WARNING: No notification daemon found! "
                  "Notifications will be ignored.")
            self.enabled = False

    def notify(self, title, message, icon=None):
        if not self.enabled:
            return
        if icon is None:
            icon = self.icon
        if Notify is not None:
            notice = self.notifier.Notification.new(title, message, icon)
        else:
            notice = notify2.Notification(title, message, icon)
        notice.set_hint_string('x-canonical-append', '')
        try:
            notice.show()
        except:
            pass

## Instruction:
Allow ValueError as a notify exception
## Code After:
from dbus.exceptions import DBusException
try:
    import gi
    gi.require_version('Notify', '0.7')
    from gi.repository import Notify
except (ImportError, AttributeError, ValueError):
    from scudcloud import notify2
    Notify = None

class Notifier(object):

    def __init__(self, app_name, icon):
        self.icon = icon
        try:
            if Notify is not None:
                Notify.init(app_name)
                self.notifier = Notify
            else:
                notify2.init(app_name)
                self.notifier = notify2
            self.enabled = True
        except DBusException:
            print("WARNING: No notification daemon found! "
                  "Notifications will be ignored.")
            self.enabled = False

    def notify(self, title, message, icon=None):
        if not self.enabled:
            return
        if icon is None:
            icon = self.icon
        if Notify is not None:
            notice = self.notifier.Notification.new(title, message, icon)
        else:
            notice = notify2.Notification(title, message, icon)
        notice.set_hint_string('x-canonical-append', '')
        try:
            notice.show()
        except:
            pass
