I got errors like this. I am trying to hash a sha256 file in Python.
I got an error like this I don't know why, how can I fix the command line?
>>> import hashlib
>>> with open("realuniq.lst") as f:
...     with open("file.txt", "w") as outfile:
...         for line in f:
...             line = line.strip()
...             hash = hashlib.sha256(line.encode()).hexdigest()
...             outfile.write(hash + "\n")
...
Traceback (most recent call last):
  File "<stdin>", line 3, in <module>
  File "/usr/lib/python3.8/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc7 in position 237: invalid continuation byte
 
    