From 5e923b9bfa6faf0eef01e824d2236e92a979b337 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Sat, 15 Oct 2016 14:47:29 +0200 Subject: [PATCH] Return None in match_best_version if not path exists. --- spacy/util.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spacy/util.py b/spacy/util.py index 90cec81e9..ee285cf80 100644 --- a/spacy/util.py +++ b/spacy/util.py @@ -53,6 +53,8 @@ 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(): + return None matches = [] for data_name in path.iterdir(): name, version = split_data_name(data_name.parts[-1])