summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gnuradio-runtime/swig/message.i8
-rw-r--r--gr-blocks/python/blocks/qa_bin_statistics.py4
2 files changed, 9 insertions, 3 deletions
diff --git a/gnuradio-runtime/swig/message.i b/gnuradio-runtime/swig/message.i
index ac13c40641..063deebc1c 100644
--- a/gnuradio-runtime/swig/message.i
+++ b/gnuradio-runtime/swig/message.i
@@ -22,6 +22,12 @@
namespace gr {
+ %pythonappend message::to_string %{
+ import sys
+ if sys.version_info[0] > 2:
+ val = val.encode("utf8", errors="surrogateescape")
+ %}
+
/*!
* \brief Message.
*
@@ -63,6 +69,8 @@ namespace gr {
long message_ncurrently_allocated();
}
+
+
%template(message_sptr) boost::shared_ptr<gr::message>;
%pythoncode %{
message_from_string = message.make_from_string
diff --git a/gr-blocks/python/blocks/qa_bin_statistics.py b/gr-blocks/python/blocks/qa_bin_statistics.py
index e6bdfaca5b..b3a8c3de81 100644
--- a/gr-blocks/python/blocks/qa_bin_statistics.py
+++ b/gr-blocks/python/blocks/qa_bin_statistics.py
@@ -30,8 +30,6 @@ from __future__ import print_function
import struct
-import six
-
from gnuradio import gr, gr_unittest, blocks
@@ -93,7 +91,7 @@ class parse_msg(object):
self.center_freq = msg.arg1()
self.vlen = int(msg.arg2())
assert(msg.length() == self.vlen * gr.sizeof_float)
- self.data = struct.unpack(b'%df' % self.vlen, six.b(msg.to_string()))
+ self.data = struct.unpack(b'%df' % self.vlen, msg.to_string())
class test_bin_statistics(gr_unittest.TestCase):