diff --git a/bincio/serve/server.py b/bincio/serve/server.py index be5ff36..052d008 100644 --- a/bincio/serve/server.py +++ b/bincio/serve/server.py @@ -631,21 +631,22 @@ async def admin_reextract_originals( Triggers a full rebuild on completion. """ import asyncio - import shutil _require_admin(bincio_session) user_dir = _get_data_dir() / handle originals_dir = user_dir / "originals" / "strava" if not originals_dir.exists(): raise HTTPException(404, f"No Strava originals directory for '{handle}'") - # Find the `uv` or `bincio` executable that launched us - uv_exe = shutil.which("uv") or "uv" + # Use the bincio script from the same venv bin dir as the running Python. + # This is reliable in systemd environments where PATH may not include uv. + import sys as _sys + bincio_exe = str(Path(_sys.executable).parent / "bincio") data_dir = str(_get_data_dir()) - log.info("reextract[%s]: spawning subprocess via %s", handle, uv_exe) + log.info("reextract[%s]: spawning subprocess via %s", handle, bincio_exe) async def event_stream(): proc = await asyncio.create_subprocess_exec( - uv_exe, "run", "bincio", "reextract-originals", + bincio_exe, "reextract-originals", "--data-dir", data_dir, "--handle", handle, stdout=asyncio.subprocess.PIPE,