I am new to python. I am writing a code to read a mask file. The code is below. It runs fine. But when I remove the print line at the end it give me the error 'unpack requires a buffer of 1 bytes'. I don't want to print the data. Any help will be appreciated.
Thank you
filehandle= open(img_path+"/"+filename[0],'rb')
byte = filehandle.read(1)
mask=np.zeros(192*132)
L=0;
while byte:
byte = filehandle.read(1)
mask[L] = struct.unpack('<B', byte)[0]
print(mask[L])
L=L+1