From: Frederic Massart Date: Mon, 9 Sep 2013 10:15:40 +0000 (+0800) Subject: Progress hook does not finish on a greater value than total X-Git-Tag: v0.5~18 X-Git-Url: https://git.cameron1729.xyz/?a=commitdiff_plain;h=89294ea641ad5237740c92483531c68ecfd68512;p=mdk.git Progress hook does not finish on a greater value than total --- diff --git a/lib/tools.py b/lib/tools.py index 3d85ab8..a70c0e4 100644 --- a/lib/tools.py +++ b/lib/tools.py @@ -116,6 +116,8 @@ def downloadProcessHook(count, size, total): """Hook to report the downloading a file using urllib.urlretrieve""" downloaded = int((count * size) / (1024)) total = int(total / (1024)) if total != 0 else '?' + if downloaded > total: + downloaded = total sys.stderr.write("\r %sKB / %sKB" % (downloaded, total)) sys.stderr.flush()