I've tracked the problem down to commit d980adf (yay git bisect!) where this line
txt = txt.replace('\r', '');
was removed from the function fixConsole() in IPython/frontend/html/notebook/static/js/utils.js. If I reinstate that line, the progressbar once again works for me.
Here's an example:
import progressbar as pb
widgets = ['Test: ', pb.Percentage(), ' ', pb.Bar(marker=pb.RotatingMarker()),
' ', pb.ETA(), ' ', pb.FileTransferSpeed()]
Neval = 1000
pbar = pb.ProgressBar(widgets=widgets, maxval=Neval).start()
for i in range(Neval):
I'm not sure whether this regression is a bug we can fix or an unavoidable side-effect of the improvements @minrk made in general to special character handling in the notebook. That logic was very involved and I know he went to a lot of trouble to handle as many special cases correctly as possible, so I'll defer to him on the handling of this one. Thanks for reporting it!
The issue is the difference between how our js interprets '\r' and how a regular terminal does.
We interpret '\r' as clearing the line before it, whereas a terminal simply moves the cursor. This is rarely an issue, because in the following, the two interpretations behave the same:
markers = '|/-\\'
for i in range(32):
m = markers[i % len(markers)]
sys.stdout.write('\r' + (m * 10))
There are two cases where they do not behave the same:
progressbar does 2., hence this issue.
You can actually fix this by changing this line in progressbar to putting \r at the head of the line instead of the tail.
Getting full \r support in the notebook is far from trivial, but we might be able to change fixCarriageReturn to handle \r at the end of a line specially.