Progressbar do not advance with `.next()` call
See original GitHub issueExpected Behavior
with the following code:
import time
import click
lst = list(range(10))
with click.progressbar(lst) as bar:
for i in lst:
next(bar)
time.sleep(0.2)
bar just don’t advance, related to https://github.com/pallets/click/issues/1125.
Actual Behavior
works fine with click-6.7.
Environment
- Python version: 3.8.2 on macOS
- Click version: 7.1.2
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (3 by maintainers)
Top Results From Across the Web
android progressBar does not update progress view/drawable
SOLUTION: It's a Bug in ProgressBar! finally... I think I found the solution... this does not work as one would expect: bar.setMax(50); bar....
Read more >How to build a progress bar indicator in Next.js - LogRocket Blog
This tutorial will address this issue by demonstrating how to build and display a progress bar indicator when changing routes in a Next.js ......
Read more >Progress Bars - Electron
A progress bar enables a window to provide progress information to the user without the need of switching to the window itself. On...
Read more >A Complete Guide to Using Python Progress Bars - Built In
A progress bar in Python indicates whether the code is working or stuck in a loop due to an error. Here's how to...
Read more >Progress Bar — Cleo 0.6.1 documentation
Whenever your task is finished, don't forget to call finish() to ensure that the progress bar display is refreshed with a 100% completion....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I don’t think this is a bug in click. You’re calling
next()
on something that may not be an iterator.I’m also not sure why you’re iterating over
lst
instead ofbar
. The following works fine:If, for some reason, you really want to iterate over
lst
instead ofbar
, you can callnext()
on an iterator overbar
(obtained usingiter()
):You got me there. It’s missing the final step. This does work:
But the first example I gave of just iterating over
bar
in thefor
loop – and not callingnext()
manually – works just fine and is the intended use case.