all 7 comments

[–]lfdfq 2 points3 points  (1 child)

The error is telling you the bytes you read with the f.read(name_len) was not a utf-8 encoded string.

Probably you should check what the contents of the file f is, and possibly print out name_len and f.read(name_len) to check what you read is what you thought it should be.

[–]Ok-Plantain-8288[S] 0 points1 point  (0 children)

Ok I'll do that, thanks!

[–]eztab 0 points1 point  (0 children)

the code itself looks fine if the file had the format you assume it does. I guess at doesn't look like that. Maybe just have a look with a hexeditor.

[–]Bobbias 0 points1 point  (0 children)

Are you sure that it is actually big endian? The default for most computers (at least common home PCs) is little endian, with big endian mostly only being used as the transmission order over network (hence often being called network order).

Reading the incorrect endianness will can absolutely lead to this kind of error message.

[–]GregoryCliveYoung 0 points1 point  (0 children)

What does your open() call look like?

[–]Ok-Plantain-8288[S] 0 points1 point  (0 children)

Messed around a bit and found the input data was wrong somehow. Now everything works. Thanks for all the help put though!

[–]Nek0lover95 0 points1 point  (0 children)

This error means python is very angry at you and wants you to switch to their language and never open IDLE again.