From e2692b5ac9e29b4c384fdbc8f828ca8ee607332f Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Fri, 25 Jul 2025 16:49:31 +0700 Subject: [PATCH] Fix inability to upgrade/downgrade from a Python 3.9 version Resolves AttributeError: module 'pip_system_certs.wrapt_requests' has no attribute 'inject_truststore' --- qt/launcher/src/main.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/qt/launcher/src/main.rs b/qt/launcher/src/main.rs index 16986fa10..2146d5548 100644 --- a/qt/launcher/src/main.rs +++ b/qt/launcher/src/main.rs @@ -644,8 +644,17 @@ fn fetch_versions(state: &State) -> Result> { let mut cmd = Command::new(&state.uv_path); cmd.current_dir(&state.uv_install_root) .args(["run", "--no-project", "--no-config", "--managed-python"]) - .args(["--with", "pip-system-certs"]) - .arg(&versions_script); + .args(["--with", "pip-system-certs"]); + + let python_version = read_file(&state.dist_python_version_path)?; + let python_version_str = + String::from_utf8(python_version).context("Invalid UTF-8 in .python-version")?; + let version_trimmed = python_version_str.trim(); + if !version_trimmed.is_empty() { + cmd.args(["--python", version_trimmed]); + } + + cmd.arg(&versions_script); let output = match cmd.utf8_output() { Ok(output) => output,