From e3b7c2827104b709793f664609b30ceb56e428cf Mon Sep 17 00:00:00 2001 From: duhaime Date: Sun, 17 Jun 2018 18:22:23 -0400 Subject: [PATCH] handle unicode image paths for Python 2.7 --- image_match/goldberg.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/image_match/goldberg.py b/image_match/goldberg.py index 072de99..da93ff8 100644 --- a/image_match/goldberg.py +++ b/image_match/goldberg.py @@ -6,6 +6,7 @@ from cairosvg import svg2png except ImportError: pass +from six import string_types, text_type from io import BytesIO import numpy as np import xml.etree @@ -233,7 +234,8 @@ def preprocess_image(image_or_path, bytestream=False, handle_mpo=False): raise CorruptImageError() img = img.convert('RGB') return rgb2gray(np.asarray(img, dtype=np.uint8)) - elif type(image_or_path) is str: + elif type(image_or_path) in string_types or \ + type(image_or_path) is text_type: return imread(image_or_path, as_grey=True) elif type(image_or_path) is bytes: try: