Pythonic's path is likely to register an error handler with codecs.register_error_handler('special', handler)and declare it in an open function:
with open('file.txt', 'r', error='special') as f:
...
, , handler UnicodeDecodeError .
, :
with open('file.txt', 'rb') as f:
for bline in f:
try:
line = bline.decode()
print(line)
except UnicodeDecodeError as e: