From 3992e0fee39010c032a71a2c1a83123a105e9c8d Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Sat, 24 Apr 2021 03:29:19 -0400 Subject: [PATCH] auto prepend python binary to args when running system command with python file as first argument --- archivebox/system.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/archivebox/system.py b/archivebox/system.py index 2dd12297..1d8cbdb0 100644 --- a/archivebox/system.py +++ b/archivebox/system.py @@ -14,7 +14,7 @@ from crontab import CronTab from .vendor.atomicwrites import atomic_write as lib_atomic_write from .util import enforce_types, ExtendedEncoder -from .config import OUTPUT_PERMISSIONS +from .config import PYTHON_BINARY, OUTPUT_PERMISSIONS @@ -37,6 +37,9 @@ def run(*args, input=None, capture_output=True, timeout=None, check=False, text= pgid = None try: + if args[0].endswith('.py'): + args = (PYTHON_BINARY, *args) + with Popen(*args, start_new_session=start_new_session, **kwargs) as process: pgid = os.getpgid(process.pid) try: