I'm writing a large bitarray to a file using this code:
import bitarray
bits = bitarray.bitarray(bin='0000011111') #just an example
with open('somefile.bin', 'wb') as fh:
bits.tofile(fh)
However, when i attempt to read this data back using:
import bitarray
a = bitarray.bitarray()
with open('somefile.bin', 'rb') as fh:
bits = a.fromfile(fh)
print bits
it fails with 'bits' being a NoneType. What am i doing wrong?