Вы используете неправильное открытие.
>>> help(open)
Help on built-in function open in module __builtin__:
open(...)
open(name[, mode[, buffering]]) -> file object
Open a file using the file() type, returns a file object. This is the
preferred way to open a file. See file.__doc__ for further information.
Как вы можете видеть, ожидается, что параметр буферизации является целым числом.:
open(filename, mode='rb', encoding=None, errors='strict', buffering=1)