Untitled
unknown
python
2 months ago
901 B
4
Indexable
def _get_python_executable(self): """ Get the path to the Python executable within the virtual environment. :return: Path to the Python executable. """ # Adjust to the root directory and locate the virtual environment project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Determine the correct Python executable based on the OS if sys.platform == "win32": python_executable = os.path.join(project_root, "venv", "Scripts", "python.exe") else: python_executable = os.path.join(project_root, "venv", "bin", "python") # Check if the Python executable exists if not os.path.exists(python_executable): self.logger.error(f"Python executable not found at {python_executable}") raise FileNotFoundError(f"Python executable not found: {python_executable}") return python_executable
Editor is loading...
Leave a Comment