850 interpreter = "" |
850 interpreter = "" |
851 clientEnv = os.environ.copy() |
851 clientEnv = os.environ.copy() |
852 if "PATH" in clientEnv: |
852 if "PATH" in clientEnv: |
853 clientEnv["PATH"] = self.__ui.getOriginalPathString() |
853 clientEnv["PATH"] = self.__ui.getOriginalPathString() |
854 |
854 |
855 if (projectLanguage.startswith("Python") or |
855 if projectLanguage in ("Python3", "MicroPython", "Cython"): |
856 projectLanguage == "MicroPython"): |
856 interpreter = self.__ericProject.getProjectInterpreter( |
857 # new code using virtual environments |
857 resolveGlobal=False) |
858 venvManager = ericApp().getObject("VirtualEnvManager") |
858 if interpreter: |
859 |
859 execPath = self.__ericProject.getProjectExecPath() |
860 # get virtual environment from project first |
|
861 venvName = self.__ericProject.getDebugProperty("VIRTUALENV") |
|
862 if not venvName: |
|
863 # get it from debugger settings next |
|
864 if projectLanguage in ("Python3", "MicroPython", "Cython"): |
|
865 venvName = Preferences.getDebugger("Python3VirtualEnv") |
|
866 if not venvName: |
|
867 venvName, _ = venvManager.getDefaultEnvironment() |
|
868 else: |
|
869 venvName = "" |
|
870 if venvName: |
|
871 interpreter = venvManager.getVirtualenvInterpreter( |
|
872 venvName) |
|
873 execPath = venvManager.getVirtualenvExecPath(venvName) |
|
874 |
860 |
875 # build a suitable environment |
861 # build a suitable environment |
876 if execPath: |
862 if execPath: |
877 if "PATH" in clientEnv: |
863 if "PATH" in clientEnv: |
878 clientEnv["PATH"] = os.pathsep.join( |
864 clientEnv["PATH"] = os.pathsep.join( |