Ensure that download command exits properly (resolves #1714)

This commit is contained in:
ines 2018-01-03 21:03:36 +01:00
parent 1081e08efb
commit dacfaa2ca4
1 changed files with 22 additions and 19 deletions

View File

@ -31,7 +31,10 @@ def download(cmd, model, direct=False):
version = get_version(model_name, compatibility)
dl = download_model('{m}-{v}/{m}-{v}.tar.gz'.format(m=model_name,
v=version))
if dl == 0:
if dl != 0:
# if download subprocess doesn't return 0, exit with the respective
# exit code before doing anything else
sys.exit(dl)
try:
# Get package path here because link uses
# pip.get_installed_distributions() to check if model is a