104 defaultPy = PythonUtilities.getPythonExecutable() |
105 defaultPy = PythonUtilities.getPythonExecutable() |
105 if "{0}.venv{0}".format(os.sep) not in defaultPy: |
106 if "{0}.venv{0}".format(os.sep) not in defaultPy: |
106 # only check for a non-embedded environment |
107 # only check for a non-embedded environment |
107 found = False |
108 found = False |
108 for venvName in self.__virtualEnvironments: |
109 for venvName in self.__virtualEnvironments: |
109 if os.path.samefile( |
110 with contextlib.suppress(FileNotFoundError): |
110 defaultPy, self.__virtualEnvironments[venvName].interpreter |
111 if os.path.samefile( |
111 ): |
112 defaultPy, self.__virtualEnvironments[venvName].interpreter |
112 found = True |
113 ): |
113 break |
114 found = True |
|
115 break |
114 if not found: |
116 if not found: |
115 # add an environment entry for the default interpreter |
117 # add an environment entry for the default interpreter |
116 self.__virtualEnvironments[ |
118 self.__virtualEnvironments[ |
117 VirtualenvManager.DefaultKey |
119 VirtualenvManager.DefaultKey |
118 ] = VirtualenvMetaData( |
120 ] = VirtualenvMetaData( |