From 311704674da83f50fef0b968062a3481330026f4 Mon Sep 17 00:00:00 2001 From: ines Date: Sun, 7 May 2017 23:24:56 +0200 Subject: [PATCH] Add path2str compat function --- spacy/compat.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spacy/compat.py b/spacy/compat.py index 1ca8a59fe..42c675b6e 100644 --- a/spacy/compat.py +++ b/spacy/compat.py @@ -32,6 +32,7 @@ if is_python2: basestring_ = basestring input_ = raw_input json_dumps = lambda data: ujson.dumps(data, indent=2).decode('utf8') + path2str = lambda path: str(path).decode('utf8') elif is_python3: bytes_ = bytes @@ -39,12 +40,13 @@ elif is_python3: basestring_ = str input_ = input json_dumps = lambda data: ujson.dumps(data, indent=2) + path2str = lambda path: str(path) def symlink_to(orig, dest): if is_python2 and is_windows: import subprocess - subprocess.call(['mklink', '/d', unicode(orig), unicode(dest)], shell=True) + subprocess.call(['mklink', '/d', path2str(orig), path2str(dest)], shell=True) else: orig.symlink_to(dest)