diff --git a/glanceclient/common/progressbar.py b/glanceclient/common/progressbar.py index 8b2b703e..cd4ffe50 100644 --- a/glanceclient/common/progressbar.py +++ b/glanceclient/common/progressbar.py @@ -15,6 +15,8 @@ import sys +import six + class _ProgressBarBase(object): """ @@ -78,7 +80,7 @@ class VerboseIteratorWrapper(_ProgressBarBase): def next(self): try: - data = self._wrapped.next() + data = six.next(self._wrapped) # NOTE(mouad): Assuming that data is a string b/c otherwise calling # len function will not make any sense. self._display_progress_bar(len(data)) @@ -89,3 +91,6 @@ class VerboseIteratorWrapper(_ProgressBarBase): # output. sys.stdout.write('\n') raise + + # In Python 3, __next__() has replaced next(). + __next__ = next