pypxlib
pypxlib copied to clipboard
Read Blob Field Value terminates on NULL
When reading Blob fields, it only reads up to the first NULL character. I am not sure whether this is intended behavior
However, changing data to raw in the _deserialize() Method of BytesField fixes the issue.
class BytesField(Field):
def _deserialize(self, pxval_value):
return pxval_value.str.val.data[:pxval_value.str.len]
# Replace with:
# return pxval_value.str.val.raw[:pxval_value.str.len]
def _serialize_to(self, value, pxval_value):
pxval_value.str.val = value
pxval_value.str.len = len(value)
Be careful when printing the Blobs though. Took me quite some time to print 40k Bytes of binary String...
I would do a Pull Request but cant currently do that.
I hope this info helps someone.