Fixing the write function for py3
from __future__ import absolute_import
import struct
+import six
from .errors import ReadError
@@ -431,7 +432,7 @@ class LengthPrefixedBlobReadWriter(ReadWriter):
return blob
def write(self, s, stream):
- if not self._is_binary:
+ if not self._is_binary or six.PY3 and isinstance(s, str):
s = s.encode('utf-8')
length = len(s)
self._length.write(length, stream)
