From fae0ce91c6595451d983def27f71623643c52af2 Mon Sep 17 00:00:00 2001 From: "Adam J. Jackson" Date: Mon, 9 Dec 2024 11:12:53 +0000 Subject: [PATCH] Allow FileNotFoundError This happens when we try to use a non-existent git command. It happens more often on Windows as we try to use more Git commands there. --- build_utils/version.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build_utils/version.py b/build_utils/version.py index 90a0a609a..2f1873c72 100644 --- a/build_utils/version.py +++ b/build_utils/version.py @@ -42,7 +42,9 @@ print(f"Trying {gitcmd} ...", file=sys.stderr) proc = subprocess.run([gitcmd, "describe", "--tags", "--dirty"], capture_output=True, check=True, text=True) - except subprocess.CalledProcessError as err: + except FileNotFoundError as err: + print(f"Tried {gitcmd}, File Not Found", file=sys.stderr) + except (subprocess.CalledProcessError) as err: print(f"Tried {gitcmd}, returned: {err}", file=sys.stderr) print(f"Stdout: '{err.stdout.strip()}'", file=sys.stderr) print(f"Stderr: '{err.stderr.strip()}'", file=sys.stderr)