reextract: use venv bincio script, not uv, to spawn subprocess
uv is unreliable in systemd environments where PATH omits ~/.local/bin. Use sys.executable's parent directory to find the venv's bincio script directly — this always works since the server itself runs from the venv.
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user