Fixed error when encoding error

Signed-off-by: Rémi BERTHO <remi.bertho@dalan.fr>
This commit is contained in:
Rémi BERTHO 2017-10-24 18:49:14 +02:00
parent 8bf32f65a5
commit 91fbfe0c00
Signed by: dalan
GPG key ID: EE3B917931C07B64

View file

@ -130,7 +130,10 @@ def main():
with open(filename, "r", encoding="utf8") as file: with open(filename, "r", encoding="utf8") as file:
string = file.read() string = file.read()
except OSError as exception: except OSError as exception:
print("Error: file not found: " + str(exception)) print("Error: file \"" + filename + "\" not found: " + str(exception))
continue
except UnicodeDecodeError as exception:
print("Error: the file \"" + filename + "\" is not UTF-8 encoded: " + str(exception))
continue continue
if args["replace"] is not None: if args["replace"] is not None: