Fixed an issue in the virtalenv manager caused by a defined virtual environment for an eric-ide server. eric7

Sun, 13 Oct 2024 12:03:05 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 13 Oct 2024 12:03:05 +0200
branch
eric7
changeset 10971
b9d883f73dff
parent 10970
2ad8a7d0867c
child 10972
2178804b1df8

Fixed an issue in the virtalenv manager caused by a defined virtual environment for an eric-ide server.

src/eric7/SystemUtilities/FileSystemUtilities.py file | annotate | diff | comparison | revisions
src/eric7/VirtualEnv/VirtualenvManager.py file | annotate | diff | comparison | revisions
--- a/src/eric7/SystemUtilities/FileSystemUtilities.py	Sat Oct 12 17:50:15 2024 +0200
+++ b/src/eric7/SystemUtilities/FileSystemUtilities.py	Sun Oct 13 12:03:05 2024 +0200
@@ -703,6 +703,7 @@
 ################################################################################
 
 
+# TODO: change these because the pattern collides with Windows drives
 _DeviceFileMarker = "device:"
 _RemoteFileMarker = "remote:"
 
--- a/src/eric7/VirtualEnv/VirtualenvManager.py	Sat Oct 12 17:50:15 2024 +0200
+++ b/src/eric7/VirtualEnv/VirtualenvManager.py	Sun Oct 13 12:03:05 2024 +0200
@@ -110,9 +110,11 @@
             # only check for a non-embedded environment
             found = False
             for venvName in self.__virtualEnvironments:
-                with contextlib.suppress(FileNotFoundError):
-                    if os.path.samefile(
-                        defaultPy, self.__virtualEnvironments[venvName].interpreter
+                interpreter = self.__virtualEnvironments[venvName].interpreter
+                with contextlib.suppress(OSError):
+                    if (
+                        not FileSystemUtilities.isRemoteFileName(interpreter)
+                        and os.path.samefile(defaultPy, interpreter)
                     ):
                         found = True
                         break

eric ide

mercurial