From 6a85c6b9399996b1db587327349de25c90699687 Mon Sep 17 00:00:00 2001 From: Mike Hiretsky Date: Wed, 17 Dec 2014 17:25:00 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pym/cl_utils.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pym/cl_utils.py b/pym/cl_utils.py index cd2acc5..5c6a199 100644 --- a/pym/cl_utils.py +++ b/pym/cl_utils.py @@ -124,7 +124,13 @@ class typeFile: def getMType(self, filename): """Информация о типе файла""" - ret = self.magicObject.file(filename) + try: + ret = self.magicObject.file(filename) + except UnicodeDecodeError: + try: + ret = self.magicObject.file(filename.decode('utf-8')) + except UnicodeDecodeError: + return None # fix for kernel 3.7.7 (bad work samba with big files) if ret is None and self.magicObject.errno() == 5: r,w = os.pipe()