Python: TypeError: Unicode-objects must be encoded before hashing
The error message means exactly what it says: You have a Unicode string. You can’t SHA-256-hash a Unicode string, you can only hash bytes. But why do you have a Unicode string? Because you’re opening a file in text mode, which means you’re implicitly asking Python to decode the bytes in that file (using your …