Downloading image with --progress fails for python3

Downloading image with --progress fails for python3 with,
TypeError: 'IterableWithLength' object is not an iterator. This
is because IterableWithLength class does not implemented python3
compatible __next__ method.

Added __next__ method for python3 compatibility.

Change-Id: Ic2114180fac26e9a60678f06612be733e8671bdb
Closes-Bug: #1671365
This commit is contained in:
Abhishek Kekane
2017-03-09 12:54:07 +05:30
parent a0edf0c2bf
commit bb2a5e946f
2 changed files with 7 additions and 2 deletions
+3
View File
@@ -471,6 +471,9 @@ class IterableWithLength(object):
def next(self):
return next(self.iterable)
# In Python 3, __next__() has replaced next().
__next__ = next
def __len__(self):
return self.length