Mon, 27 Jun 2022 17:13:05 +0200
Fixed an issue causing the standalone configuration script to crash on the API page.
eric7/Preferences/ConfigurationPages/EditorAPIsPage.py | file | annotate | diff | comparison | revisions |
--- a/eric7/Preferences/ConfigurationPages/EditorAPIsPage.py Mon Jun 27 15:49:13 2022 +0200 +++ b/eric7/Preferences/ConfigurationPages/EditorAPIsPage.py Mon Jun 27 17:13:05 2022 +0200 @@ -7,6 +7,7 @@ Module implementing the Editor APIs configuration page. """ +import contextlib import pathlib from PyQt6.QtCore import pyqtSlot @@ -132,13 +133,12 @@ """ self.projectTypeComboBox.clear() - apiProjectTypes = sorted( - [("", "")] + - [(trans, ptype) for ptype, trans in - ericApp().getObject("Project").getProjectTypes(language) - .items() - ] - ) + apiProjectTypes = [("", "")] + with contextlib.suppress(KeyError): + apiProjectTypes += sorted( + (trans, ptype) for ptype, trans in + ericApp().getObject("Project").getProjectTypes(language).items() + ) for projectTypeStr, projectType in apiProjectTypes: self.projectTypeComboBox.addItem(projectTypeStr, projectType)