In Python 2, the following will happily load the first two bytes from a binary file:
with open(file_name) as f:
b = f.read(2)
However, in Python 3, the same might result in e.g.:
UnicodeDecodeError: 'utf-8' codec can't decode byte 2: invalid start byte
Which brings me to the question: how to read N raw bytes from a file in Python 3 without specifying an encoding?