From 10a4ccba0a09754327637ed7ef82dd661654bde1 Mon Sep 17 00:00:00 2001 From: "E. Almqvist" Date: Tue, 30 Nov 2021 09:43:18 +0100 Subject: [PATCH] TypeError fix for unexpected NoneType in list FIX: TypeError: unsupported operand type(s) for +: 'int' and 'NoneType' Caused when the "finished" list is summed with the function "sum". --- speedtest.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/speedtest.py b/speedtest.py index 186b529..282eed5 100755 --- a/speedtest.py +++ b/speedtest.py @@ -1656,7 +1656,8 @@ class Speedtest(object): while _is_alive(thread): thread.join(timeout=0.001) in_flight['threads'] -= 1 - finished.append(thread.result) + if type(thread.result) in (int, float): + finished.append(thread.result) callback(thread.i, request_count, end=True) q = Queue(threads or self.config['threads']['upload'])