From 61851e36c932d8880fa814739d2e08dbb7fe27e7 Mon Sep 17 00:00:00 2001 From: Jonas Malaco Filho Date: Sun, 27 Apr 2014 02:28:56 -0300 Subject: [PATCH] Fix calling unavailable callbacks on modes csv|json|simple --- speedtest_cli.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/speedtest_cli.py b/speedtest_cli.py index 858a3b0..d6e2bce 100755 --- a/speedtest_cli.py +++ b/speedtest_cli.py @@ -784,7 +784,8 @@ class Speedtest(object): while thread.isAlive(): thread.join(timeout=0.1) finished.append(sum(thread.result)) - callback(thread.i, url_count, end=True) + if callback: + callback(thread.i, url_count, end=True) del thread q = Queue(self.config['threads']['download']) @@ -834,7 +835,8 @@ class Speedtest(object): while thread.isAlive(): thread.join(timeout=0.1) finished.append(thread.result) - callback(thread.i, size_count, end=True) + if callback: + callback(thread.i, size_count, end=True) del thread q = Queue(self.config['threads']['upload'])