Python 3 compatibility (open files in binary mode)