From d9a77ddf1422e3e58ca18a95cc9e4a1c8a85e789 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Mon, 9 Jan 2017 14:10:05 +0100 Subject: [PATCH] Return None for data path if it doesn't exist --- spacy/util.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spacy/util.py b/spacy/util.py index 457534302..1818f0be9 100644 --- a/spacy/util.py +++ b/spacy/util.py @@ -33,7 +33,7 @@ def get_lang_class(name): def get_data_path(): - return _data_path + return _data_path if _data_path.exists() else None def set_data_path(path): @@ -54,7 +54,7 @@ def or_(val1, val2): def match_best_version(target_name, target_version, path): path = path if not isinstance(path, basestring) else pathlib.Path(path) - if not path.exists(): + if path is None or not path.exists(): return None matches = [] for data_name in path.iterdir():