From d12e9f574898661f4ff65e962e755e77d5d00b00 Mon Sep 17 00:00:00 2001 From: "Ryan S. Brown" Date: Mon, 30 Jan 2017 15:45:47 -0500 Subject: [PATCH] Convert error to the native text type before writing to stderr Fixes #20588 --- lib/ansible/inventory/script.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/inventory/script.py b/lib/ansible/inventory/script.py index 0b0fb1856f..da6bb21417 100644 --- a/lib/ansible/inventory/script.py +++ b/lib/ansible/inventory/script.py @@ -77,11 +77,11 @@ class InventoryScript: try: self.raw = self._loader.load(self.data) except Exception as e: - sys.stderr.write(err + "\n") + sys.stderr.write(to_native(err) + "\n") raise AnsibleError("failed to parse executable inventory script results from {0}: {1}".format(to_native(self.filename), to_native(e))) if not isinstance(self.raw, Mapping): - sys.stderr.write(err + "\n") + sys.stderr.write(to_native(err) + "\n") raise AnsibleError("failed to parse executable inventory script results from {0}: data needs to be formatted as a json dict".format(to_native(self.filename))) group = None