I have seen different solutions for a progress bar within Python, but the simple stdout solutions are not working for my project. I have multiple classes and use the "logging" module to output information to stdout. I have a function of which I want to show a progress bar on one line, flushing the buffer each time.
Example of the simple progress:
for i in range(100):
time.sleep(1)
sys.stdout.write("\r%d%%" %i)
sys.stdout.flush()
When I try to write via stdout and then flush the buffer, either the buffer is not flushed or the progress doesn't go anywhere. I am hoping to avoid some sort of threading or complicated process to make this possible. Does someone have a preferred way of making this happen?