--- a/src/eric7/QScintilla/APIsManager.py Wed Oct 12 19:44:29 2022 +0200 +++ b/src/eric7/QScintilla/APIsManager.py Wed Oct 12 19:54:22 2022 +0200 @@ -197,29 +197,26 @@ if self.__apis is not None: qtDataDir = QLibraryInfo.path(QLibraryInfo.LibraryPath.DataPath) apisDir = os.path.join(qtDataDir, "qsci", "api") - if os.path.exists(apisDir): - if self.__lexer.language(): - apiDir = os.path.join(apisDir, self.__lexer.language()) - if not os.path.exists(apiDir): - # use lower case language - apiDir = os.path.join(apisDir, self.__lexer.language().lower()) - fnames = { - os.path.join(apiDir, f) - for f in glob.glob("*.api", root_dir=apiDir) - } - # combine with the QScintilla standard behavior - fnames |= { - os.path.join(apiDir, f) - for f in glob.glob( - "*.api", - root_dir=os.path.join(apisDir, self.__lexer.lexer()), - ) - } - return sorted(fnames) - else: - return [] - else: - return [] + if os.path.exists(apisDir) and self.__lexer.language(): + apiDir = os.path.join(apisDir, self.__lexer.language()) + if not os.path.exists(apiDir): + # use lower case language + apiDir = os.path.join(apisDir, self.__lexer.language().lower()) + fnames = { + os.path.join(apiDir, f) + for f in glob.glob("*.api", root_dir=apiDir) + } + # combine with the QScintilla standard behavior + fnames |= { + os.path.join(apiDir, f) + for f in glob.glob( + "*.api", + root_dir=os.path.join(apisDir, self.__lexer.lexer()), + ) + } + return sorted(fnames) + + return [] def __preparedName(self): """