From 0f9b8a00a5062a7819641592f5c9c2af50f8cfbc Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Mon, 9 Jan 2017 23:40:26 +0100 Subject: [PATCH] Unbreak data download --- spacy/download.py | 2 +- spacy/util.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/spacy/download.py b/spacy/download.py index 9b2d65ffc..af15e1867 100644 --- a/spacy/download.py +++ b/spacy/download.py @@ -12,7 +12,7 @@ from . import util def download(lang, force=False, fail_on_exist=True, data_path=None): if not data_path: - data_path = util.get_data_path() + data_path = util.get_data_path(require_exists=False) # spaCy uses pathlib, and util.get_data_path returns a pathlib.Path object, # but sputnik (which we're using below) doesn't use pathlib and requires diff --git a/spacy/util.py b/spacy/util.py index 1818f0be9..4ab1f71f0 100644 --- a/spacy/util.py +++ b/spacy/util.py @@ -32,8 +32,11 @@ def get_lang_class(name): return LANGUAGES[lang] -def get_data_path(): - return _data_path if _data_path.exists() else None +def get_data_path(require_exists=True): + if not require_exists: + return _data_path + else: + return _data_path if _data_path.exists() else None def set_data_path(path):