src/eric7/Preferences/ConfigurationPages/EditorFilePage.py

branch
eric7
changeset 10331
c1a2ff7e3575
parent 10307
c685f4e12916
child 10428
a071d4065202
diff -r 5ea038882dd6 -r c1a2ff7e3575 src/eric7/Preferences/ConfigurationPages/EditorFilePage.py
--- a/src/eric7/Preferences/ConfigurationPages/EditorFilePage.py	Tue Nov 21 11:42:45 2023 +0100
+++ b/src/eric7/Preferences/ConfigurationPages/EditorFilePage.py	Wed Nov 22 17:19:10 2023 +0100
@@ -7,7 +7,7 @@
 Module implementing the Editor File Handling configuration page.
 """
 
-import sys
+import importlib
 
 from PyQt6.Qsci import QsciScintilla
 from PyQt6.QtCore import pyqtSlot
@@ -402,13 +402,9 @@
         """
         Public slot to perform some polishing actions.
         """
-        try:
-            import pymdownx  # __IGNORE_WARNING__
-
-            self.previewMarkdownPyMdownInstallPushButton.setEnabled(False)
-            del sys.modules["pymdownx"]
-        except ImportError:
-            self.previewMarkdownPyMdownInstallPushButton.setEnabled(True)
+        self.previewMarkdownPyMdownInstallPushButton.setEnabled(
+            bool(importlib.util.find_spec("pymdownx"))
+        )
 
 
 def create(dlg):  # noqa: U100

eric ide

mercurial