diff -r 1798115ba35c -r a4d8091cd8f7 src/eric7/CodeFormatting/IsortFormattingDialog.py --- a/src/eric7/CodeFormatting/IsortFormattingDialog.py Fri Nov 04 11:18:07 2022 +0100 +++ b/src/eric7/CodeFormatting/IsortFormattingDialog.py Fri Nov 04 11:55:21 2022 +0100 @@ -14,7 +14,7 @@ from dataclasses import dataclass -from isort.settings import Config +from isort import settings from isort.api import check_file, sort_file from PyQt6.QtCore import pyqtSlot, Qt, QCoreApplication @@ -92,11 +92,20 @@ # given as a dictionary (i.e. data entered in the configuration dialog) # overwrites these. If the project is not passed, the isort config is based on # the isort defaults. - self.__isortConfig = ( - Config(settings_path=project.getProjectPath(), **self.__config) - if project - else Config(**self.__config) - ) + if project: + # clear the caches in order to force a re-read of config files + settings._get_config_data.cache_clear() + settings._find_config.cache_clear() + try: + self.__isortConfig = ( + settings.Config(settings_path=project.getProjectPath(), **self.__config) + if project + else settings.Config(**self.__config) + ) + except KeyError: + # invalid configuration entry found in some config file; use just the dialog + # parameters + self.__isortConfig = settings.Config(**self.__config) self.__config["__action__"] = action # needed by the workers