I am writing a large bitarray to a file using this code:
import bitarray
bits = bitarray.bitarray(bin='0000011111')
with open('somefile.bin', 'wb') as fh:
bits.tofile(fh)
However, when I try to read this data using:
import bitarray
a = bitarray.bitarray()
with open('somefile.bin', 'rb') as fh:
bits = a.fromfile(fh)
print bits
it fails when the “bits” are NoneType. What am I doing wrong?
source
share