From 91fbfe0c00ede0195084ff218a9532ff38244a12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20BERTHO?= Date: Tue, 24 Oct 2017 18:49:14 +0200 Subject: [PATCH] Fixed error when encoding error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: RĂ©mi BERTHO --- SSnR.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/SSnR.py b/SSnR.py index 90a025e..07033fa 100755 --- a/SSnR.py +++ b/SSnR.py @@ -130,7 +130,10 @@ def main(): with open(filename, "r", encoding="utf8") as file: string = file.read() 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 if args["replace"] is not None: