os.remove(zip_file_path)
except OSError as e:
// file has already been removed.
if e.errno == 2:
pass
else:
raise e
if check_sha1(file_path, sha1_hash):
return _load_vocab_file(file_path, cls)
else:
raise ValueError("Downloaded file has different hash. Please try again.")
After Change
path=temp_zip_file_path, overwrite=True)
with zipfile.ZipFile(temp_zip_file_path) as zf:
if not os.path.exists(file_path):
utils.mkdir(temp_root)
zf.extractall(temp_root)
os.replace(temp_file_path, file_path)
shutil.rmtree(temp_root)