byte string encoding fix for shapely and SerializationException

This commit is contained in:
Michael James 2016-10-19 11:50:23 -05:00
parent e980e8a170
commit 6b1cf47beb
2 changed files with 3 additions and 3 deletions

View file

@ -116,7 +116,7 @@ class ThriftClientRouter(object):
# convert the wkb to a bytearray with only positive values
byteArrWKB = bytearray([x % 256 for x in wkb.tolist()])
# convert the bytearray to a byte string and load it.
geometries.append(shapely.wkb.loads(str(byteArrWKB)))
geometries.append(shapely.wkb.loads(bytes(byteArrWKB)))
retVal = []

View file

@ -162,8 +162,8 @@ class ThriftSerializationContext(object):
elif name.find('$') > -1:
# it's an inner class, we're going to hope it's an enum, treat it special
fieldName, fieldType, fieldId = self.protocol.readFieldBegin()
if fieldName != '__enumValue__':
raise dynamiceserialize.SerializationException(b"Expected to find enum payload. Found: " + fieldName)
if fieldName.decode('utf8') != '__enumValue__':
raise dynamicserialize.SerializationException(b"Expected to find enum payload. Found: " + fieldName)
obj = self.protocol.readString()
self.protocol.readFieldEnd()
return obj