From 3d04e3303a551ee15efad1c9e98aef1d5464a2fb Mon Sep 17 00:00:00 2001 From: Paul Vinciguerra Date: Tue, 19 Mar 2019 17:32:39 -0700 Subject: vpp_papi: specify encoding for .encode()/.decode() py2 defaults to 'ascii', py3 defaults to 'utf-8'. Change-Id: Ib76d0ec56f24535e4bafd397cc6fb5e85967d508 Signed-off-by: Paul Vinciguerra --- src/vpp-api/python/vpp_papi/vpp_stats.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/vpp-api/python/vpp_papi/vpp_stats.py') diff --git a/src/vpp-api/python/vpp_papi/vpp_stats.py b/src/vpp-api/python/vpp_papi/vpp_stats.py index 0afed26215d..59c87dd6a81 100644 --- a/src/vpp-api/python/vpp_papi/vpp_stats.py +++ b/src/vpp-api/python/vpp_papi/vpp_stats.py @@ -89,7 +89,7 @@ def make_string_vector(api, strings): strings = [strings] for s in strings: vec = api.stat_segment_string_vector(vec, ffi.new("char []", - s.encode())) + s.encode('utf-8'))) return vec @@ -184,7 +184,7 @@ class VPPStats(object): poll_end_time = time.time() + timeout while time.time() < poll_end_time: - rv = self.api.stat_segment_connect_r(socketname.encode(), + rv = self.api.stat_segment_connect_r(socketname.encode('utf-8'), self.client) if rv == 0: break @@ -208,7 +208,7 @@ class VPPStats(object): raise VPPStatsIOError() rv_len = self.api.stat_segment_vec_len(rv) for i in range(rv_len): - n = ffi.string(rv[i].name).decode() + n = ffi.string(rv[i].name).decode('utf-8') e = stat_entry_to_python(self.api, rv[i]) if e is not None: stats[n] = e -- cgit 1.2.3-korg