From 1c6815ae743a04c8c815c44c81e4c6df1b3ff9c9 Mon Sep 17 00:00:00 2001 From: Jong Wook Kim Date: Mon, 15 Feb 2021 22:00:33 -0500 Subject: [PATCH] showing download progress in "MiB" --- clip/clip.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clip/clip.py b/clip/clip.py index dfb3d1e..90f9de1 100644 --- a/clip/clip.py +++ b/clip/clip.py @@ -38,7 +38,7 @@ def _download(url: str, root: str = os.path.expanduser("~/.cache/clip")): warnings.warn(f"{download_target} exists, but the SHA256 checksum does not match; re-downloading the file") with urllib.request.urlopen(url) as source, open(download_target, "wb") as output: - with tqdm(total=int(source.info().get("Content-Length")), ncols=80) as loop: + with tqdm(total=int(source.info().get("Content-Length")), ncols=80, unit='iB', unit_scale=True) as loop: while True: buffer = source.read(8192) if not buffer: