trying to fix bug
This commit is contained in:
@ -29,7 +29,7 @@ pub fn project_root() -> PathBuf {
|
||||
}
|
||||
|
||||
/// Absolute path to the bundled Python interpreter.
|
||||
/// Tries .venv312 first (new), falls back to .venv (legacy).
|
||||
/// Tries project virtualenvs in a fixed order so all runtime paths agree.
|
||||
pub fn python_exe() -> PathBuf {
|
||||
let root = project_root();
|
||||
// Packaged layout: resources/python/bin/python3
|
||||
@ -37,12 +37,24 @@ pub fn python_exe() -> PathBuf {
|
||||
if bundled.exists() {
|
||||
return bundled;
|
||||
}
|
||||
// Dev: prefer .venv312 (Python 3.12), fall back to .venv
|
||||
let venv312 = root.join(".venv312").join("bin").join("python3.12");
|
||||
if venv312.exists() {
|
||||
return venv312;
|
||||
|
||||
let candidates = [
|
||||
root.join(".venv312").join("bin").join("python3.12"),
|
||||
root.join(".venv312").join("bin").join("python"),
|
||||
root.join(".venv").join("bin").join("python3"),
|
||||
root.join(".venv").join("bin").join("python"),
|
||||
root.join("venv").join("bin").join("python3"),
|
||||
root.join("venv").join("bin").join("python"),
|
||||
];
|
||||
|
||||
for candidate in candidates {
|
||||
if candidate.exists() {
|
||||
return candidate;
|
||||
}
|
||||
}
|
||||
root.join(".venv").join("bin").join("python3")
|
||||
|
||||
// Last-resort path if no environment is present.
|
||||
root.join(".venv312").join("bin").join("python3.12")
|
||||
}
|
||||
|
||||
/// Absolute path to a script in the backend directory.
|
||||
|
||||
@ -46,7 +46,6 @@ pub fn transcribe_audio(
|
||||
// Run Python script with timeout
|
||||
let output = Command::new(python_exe)
|
||||
.args(&args)
|
||||
.env("PYTHONPATH", crate::paths::project_root().join(".venv312").join("lib").join("python3.12").join("site-packages"))
|
||||
.output()
|
||||
.map_err(|e| format!("Failed to run Python script: {}", e))?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user