from construct import PaddedString, Struct, Int32un
from pyspark import cloudpickle
fundus_header = Struct(
'width' / Int32un,
'height' / Int32un,
'bits_per_pixel' / Int32un,
'number_slices' / Int32un,
'unknown' / PaddedString(4, 'ascii'),
'size' / Int32un,
# 'img' / Int8un,
)
cloudpickle.dumps(fundus_header)
Fixing this will let us use this in Spark UDFs.
Using construct v 2.10.56:
fails with
TypeError: can't pickle Struct objectsFixing this will let us use this in Spark UDFs.