diff --git a/lib/ansible/compat/six/__init__.py b/lib/ansible/compat/six/__init__.py index 48604404198..eae73e1f712 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())