From 4d0ee6238effd2693ac2653826c9d29730afd34a Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 10 Mar 2020 14:23:40 -0400 Subject: [PATCH] Rewrite download loop The sentinal value would not get hit with python3 ('' versus b''). Change to use an easier to use while loop. Change-Id: I4d7f4b763aff1fdf13e5a53377146606de199a11 --- pyghmi/util/webclient.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyghmi/util/webclient.py b/pyghmi/util/webclient.py index 5230d111..1e0004cd 100644 --- a/pyghmi/util/webclient.py +++ b/pyghmi/util/webclient.py @@ -247,8 +247,10 @@ class SecureHTTPConnection(httplib.HTTPConnection, object): rsp = webclient.getresponse() self._currdl = rsp self._dlfile = file - for chunk in iter(lambda: rsp.read(16384), ''): + chunk = rsp.read(16384) + while chunk: file.write(chunk) + chunk = rsp.read(16384) self._currdl = None file.close()