Skip to content

Multi thread functions show only one bar #176

@AndrewLauu

Description

@AndrewLauu

Description

I am now trying to build a multi-thread downloader with progressbar. When I try to get following result:

thread-1: |###### | ETA: 5s
thread-2: |#### | ETA: 7s
thread-3: |######## | ETA: 3s

While I only got one bar with changing prefixs(thread-1,thread-3...) and changing bar in console.

Having searched a lot but didn't find solution, so hope to get your help.

Simplified codes are as followed:

Code

def download():
    respone=requests.get(url,stream=True)
    for file in progressbar.progressbar(rsponse.iter_content(...)):
        with  open(dir,'w') as f:
            f.write(file)

for i in range(3):
    t=threading.Thread(target=download,...)
    t.start
for i in range(3):
    t.join()

Versions

  • Python version: 3.7
  • Python distribution/environment: PyCharm
  • Operating System: Windows 8.1

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions