-
-
Couldn't load subscription status.
- Fork 1.4k
Open
Labels
help wanted 🙏We need you (discussion or implementation)We need you (discussion or implementation)
Description
A StackOverflow user reported another way to redirect all outputs to tqdm.write(), which is a lot more concise and as effective as ours, even more so in cases where we want to redirect all printings in all channels, not just stdout:
import inspect
import tqdm
# store builtin print
old_print = print
def new_print(*args, **kwargs):
# if tqdm.tqdm.write raises error, use builtin print
try:
tqdm.tqdm.write(*args, **kwargs)
except:
old_print(*args, ** kwargs)
# globaly replace print with new_print
inspect.builtins.print = new_print
Maybe we should add it to the documentation?
CrazyPython and joeyorlando
Metadata
Metadata
Assignees
Labels
help wanted 🙏We need you (discussion or implementation)We need you (discussion or implementation)