From 241d0e7a6448e0062cf3089db045dd8f78c7aed6 Mon Sep 17 00:00:00 2001 From: Oleh Prypin Date: Mon, 6 Jun 2016 23:32:41 +0300 Subject: [PATCH] Configure execnet to not convert Python2 str (bytes) to Python3 str (unicode) Signed-off-by: Oleh Prypin --- remoto/connection.py | 4 +++- remoto/log.py | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/remoto/connection.py b/remoto/connection.py index 98cbe48..aba5d51 100644 --- a/remoto/connection.py +++ b/remoto/connection.py @@ -26,9 +26,11 @@ class Connection(object): self.gateway = self._make_gateway(hostname) def _make_gateway(self, hostname): - return execnet.makegateway( + gateway = execnet.makegateway( self._make_connection_string(hostname) ) + gateway.reconfigure(py2str_as_py3str=False, py3str_as_py2str=False) + return gateway def _detect_sudo(self, _execnet=None): """ diff --git a/remoto/log.py b/remoto/log.py index 4284581..375e72a 100644 --- a/remoto/log.py +++ b/remoto/log.py @@ -12,6 +12,8 @@ def reporting(conn, result, timeout=None): try: received = result.receive(timeout) level_received, message = list(received.items())[0] + if not isinstance(message, str): + message = message.decode('utf-8') log_map[level_received](message.strip('\n')) except EOFError: break -- 2.47.3