[spp] [PATCH 2/2] controller: fix encoding in topo command
ogawa.yasufumi at lab.ntt.co.jp
ogawa.yasufumi at lab.ntt.co.jp
Tue Jun 12 09:03:16 CEST 2018
From: Yasufumi Ogawa <ogawa.yasufumi at lab.ntt.co.jp>
For python3, it is required to treat str and bytes explicitly for
sending and receiving messages via socket.
This update is for encoding messages to 'utf-8' similar to previous
commit '7c5193f'.
Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi at lab.ntt.co.jp>
---
src/controller/topo.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/controller/topo.py b/src/controller/topo.py
index d578290..e608961 100644
--- a/src/controller/topo.py
+++ b/src/controller/topo.py
@@ -32,7 +32,8 @@ class Topo(object):
def show(self, dtype, size):
res_ary = []
for sec_id in self.sec_ids:
- self.m2s_queues[sec_id].put("status")
+ msg = "status"
+ self.m2s_queues[sec_id].put(msg.encode('utf-8'))
res = self.format_sec_status(
sec_id, self.s2m_queues[sec_id].get(True))
res_ary.append(res)
@@ -47,7 +48,8 @@ class Topo(object):
def output(self, fname, ftype="dot"):
res_ary = []
for sec_id in self.sec_ids:
- self.m2s_queues[sec_id].put("status")
+ msg = "status"
+ self.m2s_queues[sec_id].put(msg.encode('utf-8'))
res = self.format_sec_status(
sec_id, self.s2m_queues[sec_id].get(True))
res_ary.append(res)
@@ -266,7 +268,6 @@ class Topo(object):
from distutils import spawn
# TODO(yasufum) Add check for using only supported terminal
-
if spawn.find_executable("img2sixel") is not None:
img_cmd = "img2sixel"
else:
--
2.17.1
More information about the spp
mailing list