-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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 and thread safety #548
Comments
Also related to #611 |
- 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
- 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
Are there any workarounds around this? I tried wrapping the code under a try/except block and closing pbar in case of an exception but it didn't seem to solve the issue |
Yeah, interesting behavior. It seems like if an exception gets triggered at any point, inner progressbars get spawned on new lines instead of staying on the previous line. |
@fabianp you mean this doesn't work for you? try:
with tqdm(...) as t:
for i in t:
...
except KeyboardInterrupt:
t.close()
raise
t.close() |
Any further thoughts on this? I've copied and pasted this hundreds of times now... this gets even worse if you actually need direct access to progressbar object, then you have to use contextmanagers etc. Feels like something of the sort should really be hard-baked into tqdm itself? def tqdm_iter(iterable):
pbar = tqdm.tqdm(iterable)
try:
yield from pbar
finally:
pbar.close() |
worked for me |
It should be exception safe ( It's just built-in thread safety which sometimes needs to be manually dealt with (maybe should be different issue). |
Exception
safewont-fix
)write()
after an Exception write() not printing #342refresh()
on exceptionclose()
on exception?tqdm._instances.clear()
for e.g. notebook usageThe text was updated successfully, but these errors were encountered: