From 6b1cf47bebdfc2e6055fda8f660a6b1284d20d57 Mon Sep 17 00:00:00 2001 From: Michael James Date: Wed, 19 Oct 2016 11:50:23 -0500 Subject: [PATCH] byte string encoding fix for shapely and SerializationException --- awips/dataaccess/ThriftClientRouter.py | 2 +- dynamicserialize/ThriftSerializationContext.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/awips/dataaccess/ThriftClientRouter.py b/awips/dataaccess/ThriftClientRouter.py index ba95090..327d469 100644 --- a/awips/dataaccess/ThriftClientRouter.py +++ b/awips/dataaccess/ThriftClientRouter.py @@ -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 = [] diff --git a/dynamicserialize/ThriftSerializationContext.py b/dynamicserialize/ThriftSerializationContext.py index a2992c4..7ccf30f 100644 --- a/dynamicserialize/ThriftSerializationContext.py +++ b/dynamicserialize/ThriftSerializationContext.py @@ -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