From 986015c13cf5b3ba4612280a232d5de4e890da0b Mon Sep 17 00:00:00 2001 From: "Chinmay D. Pai" Date: Thu, 20 Feb 2020 20:02:35 +0530 Subject: [PATCH] chore: substitute shutil.which with find_executable on py2 Signed-off-by: Chinmay D. Pai --- playbooks/install.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/playbooks/install.py b/playbooks/install.py index 174004df..614a2087 100644 --- a/playbooks/install.py +++ b/playbooks/install.py @@ -405,9 +405,12 @@ def parse_commandline_args(): return args if __name__ == '__main__': - if sys.version[0] == '2' and not os.environ.get('CI'): - if not raw_input("It is recommended to run this script with Python 3\nDo you still wish to continue? [Y/n]: ").lower() == "y": - sys.exit() + if sys.version[0] == '2': + from disutils.spawn import find_executable + shutil.which = find_executable + if not os.environ.get('CI'): + if not raw_input("It is recommended to run this script with Python 3\nDo you still wish to continue? [Y/n]: ").lower() == "y": + sys.exit() if not is_sudo_user(): log("Please run this script as a non-root user with sudo privileges", level=3)