From 55577d972158a588e8cf028cb692dd81e3c36def Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Fri, 20 Mar 2015 17:53:19 -0700 Subject: [PATCH] send-file: tolerate zero-byte files --- src/wormhole/scripts/progress.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wormhole/scripts/progress.py b/src/wormhole/scripts/progress.py index e74248d..2eb8ce3 100644 --- a/src/wormhole/scripts/progress.py +++ b/src/wormhole/scripts/progress.py @@ -13,7 +13,7 @@ def print_progress(completed, expected): if expected > 9999*1000*1000: short_unit_size, short_unit_name = 1000*1000*1000, "GB" - percentage_complete = 1.0 * completed / expected + percentage_complete = (1.0 * completed / expected) if expected else 1.0 bars = "#" * int(percentage_complete * 40) perc = int(100 * percentage_complete) short_unit_count = int(completed / short_unit_size)