--- a/eric6/QScintilla/Shell.py Thu Apr 15 16:52:05 2021 +0200 +++ b/eric6/QScintilla/Shell.py Thu Apr 15 18:11:24 2021 +0200 @@ -484,16 +484,13 @@ if Preferences.getEditor("ShowWhitespace"): self.setWhitespaceVisibility( QsciScintilla.WhitespaceVisibility.WsVisible) - try: + with contextlib.suppress(AttributeError): self.setWhitespaceForegroundColor( Preferences.getEditorColour("WhitespaceForeground")) self.setWhitespaceBackgroundColor( Preferences.getEditorColour("WhitespaceBackground")) self.setWhitespaceSize( Preferences.getEditor("WhitespaceSize")) - except AttributeError: - # QScintilla before 2.5 doesn't support this - pass else: self.setWhitespaceVisibility( QsciScintilla.WhitespaceVisibility.WsInvisible) @@ -2227,14 +2224,12 @@ self.vm.searchPrevAct.shortcut(), self, self.__searchPrev, self.__searchPrev) - try: + with contextlib.suppress(AttributeError): self.vm.editActGrp.setEnabled(False) self.vm.editorActGrp.setEnabled(True) self.vm.copyActGrp.setEnabled(True) self.vm.viewActGrp.setEnabled(True) self.vm.searchActGrp.setEnabled(False) - except AttributeError: - pass if not self.__windowed: self.__searchShortcut.setEnabled(True) self.__searchNextShortcut.setEnabled(True) @@ -2250,10 +2245,8 @@ @param event the event object (QFocusEvent) """ - try: + with contextlib.suppress(AttributeError): self.vm.editorActGrp.setEnabled(False) - except AttributeError: - pass if not self.__windowed: self.__searchShortcut.setEnabled(False) self.__searchNextShortcut.setEnabled(False)