NiltonVolpato / python-progressbar

Text progress bar library for Python
Other
412 stars 105 forks source link

TypeError: 'int' object is not iterable #79

Closed danielmanu93 closed 3 years ago

danielmanu93 commented 3 years ago

Hi, I'm trying to use progress bar to display iteration progress on my data, but I get this error "TypeError: 'int' object is not iterable" as shown in the image below. From the image, the error indicates it's from line 240 of the progressbar.py module file. My progressbar code is also attached. How can I fix this?

5

4

NiltonVolpato commented 3 years ago

If you look at the init method here: https://github.com/niltonvolpato/python-progressbar/blob/3f63b2f974cbdea4484dfad38a5522d369450d01/progressbar/progressbar.py#L94 you are passing the equivalent of: ProgressBar(maxval = 60, widgets = len(self.data))

So it's failing because you are passing a number as the argument widgets. You should fix the arguments you're passing.

danielmanu93 commented 3 years ago

Thanks for the reply. So do you mean the widgets argument should be a list or ?

NiltonVolpato commented 3 years ago

Yeah, they should be a list. Or None to use the default. What did you intend by passing an integer as the widgets argument?