Due to something in the Sage 8.7 kernel (currently running in CoCalc), the tqdm progress bar crashes when I try to specify its total parameter. According to the documentation, my syntax should be correct. Specifically,
from tqdm import tqdm_notebook as tqdm
g_col = graphs.nauty_geng(str(10))
for g in tqdm(g_col,total=12005168):
a=1
yields
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-17-0484b44006c5> in <module>()
1 from tqdm import tqdm_notebook as tqdm
2 graph = graphs.nauty_geng(str(Integer(10)))
----> 3 for g in tqdm(graph,total=Integer(Integer(12005168))):
4 a=Integer(1)
/ext/sage/sage-8.7_1804/local/lib/python2.7/site-packages/tqdm/__init__.pyc in tqdm_notebook(*args, **kwargs)
23 """See tqdm._tqdm_notebook.tqdm_notebook for full documentation"""
24 from ._tqdm_notebook import tqdm_notebook as _tqdm_notebook
---> 25 return _tqdm_notebook(*args, **kwargs)
26
27
/ext/sage/sage-8.7_1804/local/lib/python2.7/site-packages/tqdm/_tqdm_notebook.pyc in __init__(self, *args, **kwargs)
215 # Print initial bar state
216 if not self.disable:
--> 217 self.sp(self.__repr__()) # same as self.refresh without clearing
218
219 def __iter__(self, *args, **kwargs):
/ext/sage/sage-8.7_1804/local/lib/python2.7/site-packages/tqdm/_tqdm.pyc in __repr__(self)
982
983 def __repr__(self):
--> 984 return self.format_meter(**self.format_dict)
985
986 @property
/ext/sage/sage-8.7_1804/local/lib/python2.7/site-packages/tqdm/_tqdm.pyc in format_meter(n, total, elapsed, ncols, prefix, ascii, unit, unit_scale, rate, bar_format, postfix, unit_divisor, **extra_kwargs)
395 percentage = frac * 100
396
--> 397 l_bar += '{0:3.0f}%|'.format(percentage)
398
399 if ncols == 0:
ValueError: Unknown format code 'f' for object of type 'str'
Especially since a similar implementation of tqdm does work in a python 3 sheet, this feels like a minor bug to me. Or am I making some silly mistake?