Corrected a little glitch in the VirtualenvManager code. eric7

Mon, 11 Sep 2023 17:52:27 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Mon, 11 Sep 2023 17:52:27 +0200
branch
eric7
changeset 10203
56ff5d86807a
parent 10202
b08107707009
child 10204
9a8a0bdedd80

Corrected a little glitch in the VirtualenvManager code.

src/eric7/VirtualEnv/VirtualenvManager.py file | annotate | diff | comparison | revisions
--- 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