src/eric7/VirtualEnv/VirtualenvManager.py

branch
eric7
changeset 10203
56ff5d86807a
parent 10200
7c282bf19646
child 10204
9a8a0bdedd80
diff -r b08107707009 -r 56ff5d86807a src/eric7/VirtualEnv/VirtualenvManager.py
--- a/src/eric7/VirtualEnv/VirtualenvManager.py	Sun Sep 10 18:06:34 2023 +0200
+++ b/src/eric7/VirtualEnv/VirtualenvManager.py	Mon Sep 11 17:52:27 2023 +0200
@@ -7,6 +7,7 @@
 Module implementing a class to manage Python virtual environments.
 """
 
+import contextlib
 import copy
 import json
 import os
@@ -106,11 +107,12 @@
             # only check for a non-embedded environment
             found = False
             for venvName in self.__virtualEnvironments:
-                if os.path.samefile(
-                    defaultPy, self.__virtualEnvironments[venvName].interpreter
-                ):
-                    found = True
-                    break
+                with contextlib.suppress(FileNotFoundError):
+                    if os.path.samefile(
+                        defaultPy, self.__virtualEnvironments[venvName].interpreter
+                    ):
+                        found = True
+                        break
             if not found:
                 # add an environment entry for the default interpreter
                 self.__virtualEnvironments[

eric ide

mercurial