Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/347.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Can';不要使用progressbar33软件包_Python_Python 3.x - Fatal编程技术网

Python Can';不要使用progressbar33软件包

Python Can';不要使用progressbar33软件包,python,python-3.x,Python,Python 3.x,我想显示下载进度,但无法按预期运行, 这是我的密码 import requests from progressbar import Bar, ETA, FileTransferSpeed, ProgressBar link = video_mp4_link file_name = "download.mp4" with open(file_name, "wb") as f: print("Downloading {}".format(file_name)) response

我想显示下载进度,但无法按预期运行, 这是我的密码

import requests
from progressbar import Bar, ETA, FileTransferSpeed, ProgressBar


link = video_mp4_link
file_name = "download.mp4"

with open(file_name, "wb") as f:
    print("Downloading {}".format(file_name))
    response = requests.get(link, stream=True)
    total_length = int(response.headers.get('content-length'))

    widgets = ['[Downlaoding] ', Percentage(), ' ', Bar(),
            ' ', ETA(), ' ', FileTransferSpeed()]

    pbar = ProgressBar(widgets=widgets, maxval=total_length).start()
    for data in response.iter_content(chunk_size=4096):
        f.write(data)
        done = int(os.path.getsize('Tree_Scraper.py'))
        pbar.update(done)
    pbar.finish()

下载文件时,会显示如下进度:

[下载]0%|预计到达时间:35天,3:50:24 600 B/s
进度条卡在0%,预计到达时间为35~100天,下载速度为 B/s


下载文件后,进度如下:

[码码>[倒倒老老丁]10%码码>[码码>[下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载下载

使用的软件包:

progressbar33
请求

发生了什么事