From 9d9872d32577ea78a89a08a96a7398edccc5f5f0 Mon Sep 17 00:00:00 2001 From: Ross Williams Date: Mon, 20 Mar 2023 14:25:29 -0400 Subject: [PATCH] bin_version means to modify, not replace environ the `bin_version` function means to modify the environment, not replace it entirely. Fixes bugs that occur when it wipes out the PATH environment variable, such as when running in a virtual environment. --- archivebox/config.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/archivebox/config.py b/archivebox/config.py index 4d1546af..739d7f12 100644 --- a/archivebox/config.py +++ b/archivebox/config.py @@ -690,7 +690,8 @@ def bin_version(binary: Optional[str]) -> Optional[str]: return None try: - version_str = run([abspath, "--version"], stdout=PIPE, env={'LANG': 'C'}).stdout.strip().decode() + bin_env = os.environ | {'LANG': 'C'} + version_str = run([abspath, "--version"], stdout=PIPE, env=bin_env).stdout.strip().decode() if not version_str: version_str = run([abspath, "--version"], stdout=PIPE).stdout.strip().decode() # take first 3 columns of first line of version info