--- a/eric6/QScintilla/Lexers/LexerCSS.py Thu Apr 15 16:52:05 2021 +0200 +++ b/eric6/QScintilla/Lexers/LexerCSS.py Thu Apr 15 18:11:24 2021 +0200 @@ -7,6 +7,8 @@ Module implementing a CSS lexer with some additional methods. """ +import contextlib + from PyQt5.Qsci import QsciLexerCSS from .Lexer import Lexer @@ -49,15 +51,13 @@ """ self.setFoldComments(Preferences.getEditor("CssFoldComment")) self.setFoldCompact(Preferences.getEditor("AllFoldCompact")) - try: + with contextlib.suppress(AttributeError): self.setHSSLanguage( Preferences.getEditor("CssHssSupport")) self.setLessLanguage( Preferences.getEditor("CssLessSupport")) self.setSCSSLanguage( Preferences.getEditor("CssSassySupport")) - except AttributeError: - pass def isCommentStyle(self, style): """