Skip to content
Advertisement

display progress bar in console while copying files. using tqdm in python

I have a python script that read from source folder and copy existing files into the specified destination using shutil package.

I want to show a progress bar while copying these files so i tried to import tqdm package, but when i try to run the program it crash and display the below error:

for obj in iterable : typeError: ‘int’ object is not iterable

code:

JavaScript

Advertisement

Answer

tqdm expects an iterable argument.

In this line in your code

JavaScript

numfile is an integer. Try using range(numfile) perhaps?

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement