From e445a61974ccfbe649097209b9265cb0181bef5c Mon Sep 17 00:00:00 2001 From: Morgan Blackthorne Date: Tue, 19 May 2026 06:53:18 -0700 Subject: [PATCH] Fix bin/plexadm to use venv site-packages when available When the venv Python symlinks back to the system Python (common on Linux), os.execv re-exec is a no-op and the venv's site-packages never land on sys.path. Explicitly insert the venv's site-packages directory so dependencies like python-dotenv are found without requiring a system-wide install or manual venv activation. Co-Authored-By: Claude Sonnet 4.6 --- bin/plexadm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bin/plexadm b/bin/plexadm index ccdc6ea..768d5ea 100755 --- a/bin/plexadm +++ b/bin/plexadm @@ -3,6 +3,11 @@ import sys from pathlib import Path repo_root = Path(__file__).resolve().parents[1] + +venv_site = next(iter((repo_root / ".venv" / "lib").glob("python*/site-packages")), None) if (repo_root / ".venv").exists() else None +if venv_site and str(venv_site) not in sys.path: + sys.path.insert(0, str(venv_site)) + sys.path.insert(0, str(repo_root)) installed_lib = Path("/usr/local/lib/plexadm")