From a3404418c04a1272e5c0d08966a27b99dd304626 Mon Sep 17 00:00:00 2001 From: Nathaniel Case Date: Wed, 2 Aug 2017 14:10:05 -0400 Subject: [PATCH] Fix Python3 in ansible-connection (#27645) * Fix Python3 in ansible-connection * Add `errors='surrogate_or_strict'` to `to_bytes()` --- bin/ansible-connection | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/ansible-connection b/bin/ansible-connection index 84fdc06fb0..a3e3c7cf41 100755 --- a/bin/ansible-connection +++ b/bin/ansible-connection @@ -250,7 +250,8 @@ class Server(): break time.sleep(1) timeout -= 1 - return 0, b'\n#SOCKET_PATH#: %s\n' % self.socket_path, '' + socket_bytes = to_bytes(self.socket_path, errors='surrogate_or_strict') + return 0, b'\n#SOCKET_PATH#: %s\n' % socket_bytes, '' def communicate(sock, data):