From b77de1bd5dbeb8cfb42c8b7589c60a0353f77ee0 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Mon, 6 Nov 2017 07:27:47 -0800 Subject: If we can't find a .py file for the system six, use our bundled copy instead. Fixes #32567 --- lib/ansible/compat/six/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/ansible/compat/six/__init__.py b/lib/ansible/compat/six/__init__.py index 4860440419..eae73e1f71 100644 --- a/lib/ansible/compat/six/__init__.py +++ b/lib/ansible/compat/six/__init__.py @@ -50,5 +50,12 @@ if _system_six: six = _system_six else: from . import _six as six + six_py_file = '{0}.py'.format(os.path.splitext(six.__file__)[0]) +if not os.path.exists(six_py_file): + # Only the .pyc/.pyo version of six was installed but we need a .py file + # Fallback to the bundled copy + from . import _six as six + six_py_file = '{0}.py'.format(os.path.splitext(six.__file__)[0]) + exec(open(six_py_file, 'rb').read()) -- cgit v1.2.1