From 89294ea641ad5237740c92483531c68ecfd68512 Mon Sep 17 00:00:00 2001 From: Frederic Massart Date: Mon, 9 Sep 2013 18:15:40 +0800 Subject: [PATCH] Progress hook does not finish on a greater value than total --- lib/tools.py | 2 ++ 1 file changed, 2 insertions(+) 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() -- 2.11.0