diff --git a/tqdm/_tqdm.py b/tqdm/_tqdm.py index 71e05b2a..e80091be 100755 --- a/tqdm/_tqdm.py +++ b/tqdm/_tqdm.py @@ -478,7 +478,9 @@ class tqdm(Comparable): """ with cls._lock: try: - cls._instances.remove(instance) + if instance in cls._instances: + # in python2 instance maybe magically removed from cls._instances + cls._instances.remove(instance) except KeyError: if not instance.gui: # pragma: no cover raise