diff options
| author | historia <historiavg@proton.me> | 2026-08-28 04:18:56 -0400 |
|---|---|---|
| committer | historia <historiavg@proton.me> | 2026-08-28 04:18:56 -0400 |
| commit | 876a6eb3ba9974d0eadc1fd3f628dafdc56d8716 (patch) | |
| tree | 8a788f19c7494c7133ecd94ec2bfb9813d3c0f83 /app/backends/envs.py | |
| parent | 5247b2f2f83e224f3438e0afa552f2b4728d51c2 (diff) | |
| download | tts-audiobook-generator-876a6eb3ba9974d0eadc1fd3f628dafdc56d8716.tar.gz | |
fix: system python used instead of venv python, breaking whisper transcription
Diffstat (limited to 'app/backends/envs.py')
| -rw-r--r-- | app/backends/envs.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/app/backends/envs.py b/app/backends/envs.py index ff6d1bf..494c3e2 100644 --- a/app/backends/envs.py +++ b/app/backends/envs.py @@ -89,9 +89,16 @@ def env_exists(env_dir: Optional[Path] = None) -> bool: def is_managed_env() -> bool: - """True when the current process is already running inside the app venv.""" + """True when the current process is already running inside the app venv. + + Compares sys.prefix (the environment the current interpreter belongs to) + with ENV_DIR instead of the interpreter path: a venv's bin/python is + typically a symlink to the base interpreter, so resolving sys.executable + would also make the bare system python look like the managed env and + silently skip the bootstrap (and with it the requirements install). + """ try: - return Path(sys.executable).resolve() == env_python().resolve() + return Path(sys.prefix).resolve() == ENV_DIR.resolve() except OSError: return False |
