When an empty string is used as the key, this error message is displayed:
Traceback (most recent call last):
File "/home/mrenda/tmp/./test_multibar.py", line 22, in <module>
multibar.render()
File "/home/mrenda/.venv/lib/python3.11/site-packages/progressbar/multi.py", line 208, in render
update()
File "/home/mrenda/.venv/lib/python3.11/site-packages/progressbar/multi.py", line 182, in update
output.append(bar_.fd.line)
^^^^^^^^^^^^
AttributeError: '_io.TextIOWrapper' object has no attribute 'line'
MultiBar should support an empty string as key or, if not possible, an assert should be added, so the issue is caught early.
Code
This code reproduces the issue:
import random
import threading
import time
import progressbar
BARS = 5
N = 50
multibar = progressbar.MultiBar()
for i in range(BARS):
multibar[f'Thread label here {i}' if i != 0 else ''] = progressbar.ProgressBar(max_value=N)
for n in range(N):
for name in multibar:
bar = multibar[name]
bar.update(n)
time.sleep(0.1)
multibar.render()
Ps. Feel also free to add a polished version code (without the empty key section) in the example to show how to create a non-threaded version of the MultiBar
Description
When an empty string is used as the key, this error message is displayed:
MultiBar should support an empty string as key or, if not possible, an assert should be added, so the issue is caught early.
Code
This code reproduces the issue:
Ps. Feel also free to add a polished version code (without the empty key section) in the example to show how to create a non-threaded version of the MultiBar
Versions