I am trying to download files in python using the wget module. I understand that it's supposed to have several progress bar modes but non actually show in the console.
I could not find any documentation for this module.
import wget
from pathlib import Path
print('Beginning download...')
url = 'https://storage.googleapis.com/meirtvmp3/archive/hebrew/mp3/sherki/daattvunot/idx_69115.mp3'
wget.download(url)
The file downloads but no progress bar shows.
The source code for the module does have a reference to it. But when I try it in my code python cant find a reference to it.
EDIT
I tested the script from the terminal and it worked as expected. I guess it's a pycharm/venv bug.
This works for me,
#create this bar_progress method which is invoked automatically from wget
def bar_progress(current, total, width=80):
progress_message = "Downloading: %d%% [%d / %d] bytes" % (current / total * 100, current, total)
# Don't use print() as it will print in new line every time.
sys.stdout.write("\r" + progress_message)
sys.stdout.flush()
#Now use this like below,
url = 'http://url_to_download'
save_path = "/home/save.file"
wget.download(url, save_path, bar=bar_progress)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.