--- a/eric6/Tasks/Task.py Wed Apr 14 19:38:19 2021 +0200 +++ b/eric6/Tasks/Task.py Wed Apr 14 19:59:16 2021 +0200 @@ -9,6 +9,7 @@ import os import time +import contextlib from PyQt5.QtCore import Qt, QUuid from PyQt5.QtWidgets import QTreeWidgetItem @@ -144,13 +145,10 @@ nonBoldFont = self.font(0) nonBoldFont.setBold(False) for col in range(5): - try: + with contextlib.suppress(KeyError): self.setBackground( col, Preferences.getTasks( Task.TaskType2ColorName[self.taskType])) - except KeyError: - # do not set background color if type is not known - pass if self._isProjectTask: self.setFont(col, boldFont)