[Tutor] Serializing bytestring as JSON

S D zebra05 at gmail.com
Sun Aug 9 23:04:17 EDT 2020


Hi. If you're reading this, I hope you're healthy and safe.

I built an RPC service based on the Nameko framework. The service class
implements a method which takes a list of strings as an argument and
returns a dictionary with each original string as a key and the string
Huffman encoded as a value. The encoding works, but I cannot send the
return value across the network because the encoded bytestrings cannot be
serialized to JSON.

If I import the service class and test the methods using PyTest, this
problem is not reproduced.

How can I return a Huffman encoded bytestring over a wire as JSON?

TIA.


Kind regards,
~ SD


More information about the Tutor mailing list