From ad73cba3caa2e08ad61ea9ca63f9111cde1f48d1 Mon Sep 17 00:00:00 2001 From: philwo Date: Mon, 24 Jul 2017 18:54:55 +0200 Subject: [PATCH] Fix python_stub_template.txt to be compatible with Python 2.4. PiperOrigin-RevId: 162949753 --- .../build/lib/bazel/rules/python/python_stub_template.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/python/python_stub_template.txt b/src/main/java/com/google/devtools/build/lib/bazel/rules/python/python_stub_template.txt index 218f6aeae2a68e..2aacd411e6bbf0 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/python/python_stub_template.txt +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/python/python_stub_template.txt @@ -166,7 +166,9 @@ def Main(): exit(retCode) else: os.execv(args[0], args) - except EnvironmentError as e: + except EnvironmentError: + # This works from Python 2.4 all the way to 3.x. + e = sys.exc_info()[1] # This exception occurs when os.execv() fails for some reason. if not getattr(e, 'filename', None): e.filename = program # Add info to error message