Fixed an issue causing the standalone configuration script to crash on the API page. eric7

Mon, 27 Jun 2022 17:13:05 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Mon, 27 Jun 2022 17:13:05 +0200
branch
eric7
changeset 9185
8975ed45c22d
parent 9184
c3572cd1a288
child 9186
0c28a1670e06

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)
     

eric ide

mercurial