From 32473901234a4641094562a9d0629ff353d22966 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Wed, 2 Mar 2016 09:34:07 -0500 Subject: [PATCH] Conditionally import StringIO in template so we only use io.StringIO on py3 --- lib/ansible/template/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/ansible/template/__init__.py b/lib/ansible/template/__init__.py index a7a8ac4a37c..e780c245cdd 100644 --- a/lib/ansible/template/__init__.py +++ b/lib/ansible/template/__init__.py @@ -23,7 +23,11 @@ import ast import contextlib import os import re -from io import StringIO + +try: + from StringIO import StringIO +except ImportError: + from io import StringIO from ansible.compat.six import string_types, text_type, binary_type from jinja2 import Environment