From fa765202402499486efd1cb3484c5e70555479c2 Mon Sep 17 00:00:00 2001 From: thomwolf Date: Wed, 17 Apr 2019 13:32:22 +0200 Subject: [PATCH] fix file_utils on python 2 --- 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 6a24b099e1..6de7e259e5 100644 --- a/pytorch_pretrained_bert/file_utils.py +++ b/pytorch_pretrained_bert/file_utils.py @@ -227,7 +227,7 @@ def get_from_cache(url, cache_dir=None): meta = {'url': url, 'etag': etag} meta_path = cache_path + '.json' with open(meta_path, 'w', encoding="utf-8") as meta_file: - meta_file.write(json.dumps(meta)) + json.dump(meta, meta_file) logger.info("removing temp file %s", temp_file.name)