From 8647a8739d61bc084cf80a8263afb4dd63151e6f Mon Sep 17 00:00:00 2001 From: Daniele Rondina Date: Sat, 17 Aug 2019 17:16:51 +0200 Subject: [PATCH] Handle unicode decode error as not text file - #77 --- lib/entropy/tools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/entropy/tools.py b/lib/entropy/tools.py index 44ec935d2..bbae28852 100644 --- a/lib/entropy/tools.py +++ b/lib/entropy/tools.py @@ -1927,7 +1927,7 @@ def istextfile(filename, blocksize = 512): try: with open(filename, "r") as f: r = istext(f.read(blocksize)) - except (OSError, IOError): + except (OSError, IOError, UnicodeDecodeError): return False return r