From 0c970caa4a0d7744df89666c537fd5e6adc2a3eb Mon Sep 17 00:00:00 2001 From: Aaron Mangum Date: Mon, 4 Mar 2019 14:30:19 -0800 Subject: [PATCH] catch exception if pathlib not install --- pytorch_pretrained_bert/file_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytorch_pretrained_bert/file_utils.py b/pytorch_pretrained_bert/file_utils.py index b475d450f6..8601edde23 100644 --- a/pytorch_pretrained_bert/file_utils.py +++ b/pytorch_pretrained_bert/file_utils.py @@ -29,7 +29,7 @@ try: from pathlib import Path PYTORCH_PRETRAINED_BERT_CACHE = Path(os.getenv('PYTORCH_PRETRAINED_BERT_CACHE', Path.home() / '.pytorch_pretrained_bert')) -except AttributeError: +except (AttributeError, ImportError): PYTORCH_PRETRAINED_BERT_CACHE = os.getenv('PYTORCH_PRETRAINED_BERT_CACHE', os.path.join(os.path.expanduser("~"), '.pytorch_pretrained_bert'))