From ab775cf235d82d048197190727cf851ed1c4062c Mon Sep 17 00:00:00 2001 From: Campbell Barton <ideasman42@gmail.com> Date: Thu, 28 Apr 2022 17:16:35 +1000 Subject: [PATCH] Fix error in a670766112113c9e84a5629d4ee35c65b592387f Missed prepending Python to the autopep8 command for the version check --- utils_maintenance/autopep8_format_paths.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/utils_maintenance/autopep8_format_paths.py b/utils_maintenance/autopep8_format_paths.py index 5793700..26e749a 100644 --- a/utils_maintenance/autopep8_format_paths.py +++ b/utils_maintenance/autopep8_format_paths.py @@ -67,8 +67,13 @@ def autopep8_ensure_version(): continue else: autopep8_format_cmd = "autopep8" + + cmd = [autopep8_format_cmd] + if cmd[0].endswith(".py"): + cmd = [sys.executable, *cmd] + try: - version_output = subprocess.check_output((autopep8_format_cmd, "--version")).decode('utf-8') + version_output = subprocess.check_output((*cmd, "--version")).decode('utf-8') except FileNotFoundError as e: continue AUTOPEP8_FORMAT_CMD = autopep8_format_cmd @@ -83,7 +88,7 @@ def autopep8_ensure_version(): def autopep8_format(files): - cmd = [*AUTOPEP8_FORMAT_CMD, "--recursive", "--in-place", "--jobs=0"] + files + cmd = [AUTOPEP8_FORMAT_CMD, "--recursive", "--in-place", "--jobs=0"] + files # Support executing from the module directory because Blender does not distribute the command. if cmd[0].endswith(".py"): -- GitLab