From 9f3e5ceb14cbec68561433a820de87a8954adc7b Mon Sep 17 00:00:00 2001 From: Marius Gedminas Date: Wed, 30 Sep 2015 09:08:41 +0300 Subject: [PATCH] Make sure 'basestring', 'bytes' and 'unicode' are defined Python 3 doesn't have 'basestring' and 'unicode'. Python 2.4 doesn't have 'bytes' --- lib/ansible/module_utils/basic.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/ansible/module_utils/basic.py b/lib/ansible/module_utils/basic.py index 582aa35e3b2..0995fdd7582 100644 --- a/lib/ansible/module_utils/basic.py +++ b/lib/ansible/module_utils/basic.py @@ -73,6 +73,22 @@ try: except ImportError: imap = map # Python 3 +try: + basestring +except NameError: + basestring = str # Python 3 + +try: + unicode +except NameError: + unicode = str # Python 3 + +try: + bytes +except NameError: + bytes = str # Python 2 + + try: import json # Detect the python-json library which is incompatible