python-progressbar
python-progressbar copied to clipboard
Prefix is not working
Hi, the download speed as well as file size value is shown correct but there is no prefix. Speed: 3.3 B/s Size: 121.0 B instead of Speed: 3.3 MiB/s Size: 121.0 MiB
I tried FileTransferSpeed() and AdaptiveTransferSpeed() both, but same issue.
Versions
- Python version:
3.10 - Python distribution/environment: CPython
- Operating System: Windows 10
- Package version:
3.55.0
What are you passing along as a value? If you're setting it to 3.3 it will be 3.3 bytes. For 3.3 MiB you need 3.3*1024*1024 = 3460300 instead.
I just kept it empty 🙄
In that case I am guessing that you are updating the progress bar every megabyte instead of every byte. Hard to say without the code though ;)
Since an extreme amount of updates is generally not ideal for performance either, I would recommend explicitly updating with the amount of bytes you've downloaded. This should do the trick: bar.update(bytes)