From 00083321b340c732d6fda79879fb5d5d60853b59 Mon Sep 17 00:00:00 2001 From: Mike Hiretsky Date: Fri, 21 Jan 2011 09:30:54 +0300 Subject: [PATCH] Fix for work with file-5.05. --- pym/cl_utils.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pym/cl_utils.py b/pym/cl_utils.py index b84d6e6..d6fa979 100644 --- a/pym/cl_utils.py +++ b/pym/cl_utils.py @@ -28,7 +28,11 @@ import re import sys import getpass from types import StringType -import magic as type_file + +try: + from magic import open as type_file, MAGIC_NONE as MAGIC_NONE +except ImportError: + from magic import open as type_file, NONE as MAGIC_NONE import cl_lang tr = cl_lang.lang() @@ -73,7 +77,7 @@ class typeFile: """Получение типа файла""" def __init__(self, magic=0x410): - self.magicObject = type_file.open(type_file.MAGIC_NONE) + self.magicObject = type_file(MAGIC_NONE) self.magicObject.load() self.magicObject.setflags(magic)