Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception printed when breaking out of loop #596

Closed
3 tasks done
artoonie opened this issue Aug 17, 2018 · 3 comments · Fixed by #607
Closed
3 tasks done

Exception printed when breaking out of loop #596

artoonie opened this issue Aug 17, 2018 · 3 comments · Fixed by #607
Labels
duplicate 🗐 Seen it before p2-bug-warning ⚠ Visual output bad synchronisation ⇶ Multi-thread/processing to-fix ⌛ In progress

Comments

@artoonie
Copy link

artoonie commented Aug 17, 2018

  • I have visited the source website, and in particular
    read the known issues
  • I have searched through the issue tracker for duplicates
  • I have mentioned version numbers, operating system and
    environment, where applicable:
    import tqdm, sys
    print(tqdm.__version__, sys.version, sys.platform)

Version:

('4.24.0', '2.7.15 (default, May  1 2018, 16:44:14) \n[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)]', 'darwin')

To reproduce:

import tqdm
for i in tqdm.tqdm(xrange(100)): break

output:

  0%|                                            | 0/100 [00:00<?, ?it/s]
Exception KeyError: KeyError(<weakref at 0x102e6a470; to 'tqdm' at 0x102e4c650>,) in <bound method tqdm.__del__ of   0%|                                                                                                                                                                                                                                                                                                                                                                                                             | 0/100 [00:00<?, ?it/s]> ignored
@casperdcl
Copy link
Member

bars need to be closed:

from tqdm import trange

with trange(100) as t:
    for i in t:
        break
  0%|                                      | 0/100 [00:00<?, ?it/s]

Doesn't work:

for i in trange(100):
    break
  0%|                                      | 0/100 [00:00<?, ?it/s]
Exception KeyError: KeyError(<weakref at 0x7fb4316aa0; to 'tqdm' at 0x7fb41f2090>,) in <bound method tqdm.__del__ of   0%|                                      | 0/100 [00:00<?, ?it/s]> ignored

Duplicate of: #548, #553

@casperdcl casperdcl added p2-bug-warning ⚠ Visual output bad duplicate 🗐 Seen it before synchronisation ⇶ Multi-thread/processing to-fix ⌛ In progress labels Aug 18, 2018
@chengs
Copy link
Contributor

chengs commented Sep 10, 2018

@casperdcl it seems python2 will cycle the tqdm when called like this

for _ in trange(10):
   pass

So, WeakSet should be replaced by Set for python27.
But, why we need to use WeakSet? How about using Set for all python versions?

@casperdcl
Copy link
Member

closing as duplicate of #548

casperdcl added a commit that referenced this issue Oct 15, 2018
- fix `str.isnumeric` #605
- fix `WeakSet` `KeyError` #548, #553, #596 -> #607
- stop `tqdm_notebook` description truncation #582 -> #599
- include `unit_scale` for `rate` #608
- add `auto` -> nowarning `autonotebook`
- add better postfix numeric formatting #621
- minor refactoring #609 -> #616
- update documentation
- add unit tests
- fix py26 CI
casperdcl added a commit that referenced this issue Oct 15, 2018
- fix `str.isnumeric` #605
- fix `WeakSet` `KeyError` #548, #553, #596 -> #607
- stop `tqdm_notebook` description truncation #582 -> #599
- include `unit_scale` for `rate` #608
- add `auto` -> nowarning `autonotebook`
- add better postfix numeric formatting #621
- minor refactoring #609 -> #616
- update documentation
- add unit tests
- fix py26 CI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate 🗐 Seen it before p2-bug-warning ⚠ Visual output bad synchronisation ⇶ Multi-thread/processing to-fix ⌛ In progress
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants