Python fileinput: Keep file unchanged in case of exception
Python fileinput: Keep file unchanged in case of exception Question: I have a program that uses Python 3 fileinput to replace some text within files in-place. Some files causes UnicodeDecodeError as I expect since they are non-readable/binary files, but when the exception occurs these files are completely emptied out from their content. I can see …