The "file_head" is a 'bytes-like object ,not 'str'. Update file_head.split() to file_head.decode('utf-8').split() Change-Id: Ic912cc86d9a5afbdbcd63f27e1f91d2140f9b9ba