--- a/eric6/UI/NotificationWidget.py Thu Apr 15 16:52:05 2021 +0200 +++ b/eric6/UI/NotificationWidget.py Thu Apr 15 18:11:24 2021 +0200 @@ -8,6 +8,7 @@ """ from enum import Enum +import contextlib from PyQt5.QtCore import Qt, QTimer, QPoint from PyQt5.QtWidgets import QFrame, QWidget, QVBoxLayout @@ -237,12 +238,9 @@ # delete the notification index = self.__layout.indexOf(notification) self.__layout.takeAt(index) - try: + with contextlib.suppress(ValueError): self.__notifications.remove(notification) notification.deleteLater() - except ValueError: - # it was already delete by other method; ignore - pass if self.__layout.count(): self.__adjustSizeAndPosition()