From: ogawa.yasufumi@lab.ntt.co.jp
To: ferruh.yigit@intel.com, spp@dpdk.org
Cc: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
Subject: [spp] [PATCH 2/2] controller: fix encoding in topo command
Date: Tue, 12 Jun 2018 16:03:16 +0900 [thread overview]
Message-ID: <20180612070316.5261-3-ogawa.yasufumi@lab.ntt.co.jp> (raw)
In-Reply-To: <20180612070316.5261-1-ogawa.yasufumi@lab.ntt.co.jp>
From: Yasufumi Ogawa <ogawa.yasufumi@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@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
next prev parent reply other threads:[~2018-06-12 7:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-12 7:03 [spp] [PATCH 0/2] Python 3 support for " ogawa.yasufumi
2018-06-12 7:03 ` [spp] [PATCH 1/2] controller: fix bug of topo to refer external cmd ogawa.yasufumi
2018-06-12 7:03 ` ogawa.yasufumi [this message]
2018-06-27 10:49 ` [spp] [PATCH 0/2] Python 3 support for topo command Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180612070316.5261-3-ogawa.yasufumi@lab.ntt.co.jp \
--to=ogawa.yasufumi@lab.ntt.co.jp \
--cc=ferruh.yigit@intel.com \
--cc=spp@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).