Aug-29-2018, 12:14 AM
Thanks for the help, @buran. This forum has been most helpful to me.
Well I finally figured out the problem.
Well I finally figured out the problem.
def get_ebml_id(file): byte = file.read(1) dec = ord(byte) if dec & 0b10000000: #1 byte long EBML ID return byte elif dec & 0b01000000: #2 bytes long EBML ID return struct.unpack('>H', byte + file.read(1))[0] elif dec & 0b00100000: #3 bytes long EBML ID return struct.unpack('>L', b'\0' + byte + file.read(2))[0] elif dec & 0b00010000: #4 bytes long EBML ID return struct.unpack('>L', byte + file.read(3))[0]If the byte read is supposed to be one byte long, it returns a byte object. It was throwing off an otherwise correct script. So, I changed
if dec & 0b10000000: #1 byte long EBML ID return byte...to
if dec & 0b10000000: # 1 byte long EBML ID return int.from_bytes(byte, byteorder='big')...and all works as expected. I have learned that bytes objects are definitely not integers.