Skip to content

tqdm_notebook fails if disable=True #184

@jcmgray

Description

@jcmgray

This a very small issue but the disable option can be useful for cleanly and programmatically limiting the number of progress bars (in nested loops etc.).

from tqdm import tqdm_notebook

no_progress_bar = True

for i in tqdm_notebook([1, 2, 3], disable=no_progress_bar):
    pass

Currently produces:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-3-6f85a3e4d95f> in <module>()
      1 from tqdm import tqdm_notebook
      2 
----> 3 for i in tqdm_notebook(range(2), disable=True):
      4     pass

/home/johnnie/conda/lib/python3.5/site-packages/tqdm/__init__.py in tqdm_notebook(*args, **kwargs)
     17     """See tqdm._tqdm_notebook.tqdm_notebook for full documentation"""
     18     from ._tqdm_notebook import tqdm_notebook as _tqdm_notebook
---> 19     return _tqdm_notebook(*args, **kwargs)
     20 
     21 

/home/johnnie/conda/lib/python3.5/site-packages/tqdm/_tqdm_notebook.py in __init__(self, *args, **kwargs)
    166         # self.sp('', close=True)
    167         # Replace with IPython progress bar display (with correct total)
--> 168         self.sp = self.status_printer(self.fp, self.total, self.desc)
    169         self.desc = None  # trick to place description before the bar
    170 

AttributeError: 'tqdm_notebook' object has no attribute 'fp'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions