Redirect print command in python script through tqdm.write()
Redirecting sys.stdout is always tricky, and it becomes a nightmare when two applications are twiddling with it at the same time. Here the trick is that tqdm by default prints to sys.stderr, not sys.stdout. Normally, tqdm has an anti-mixup strategy for these two special channels, but since you are redirecting sys.stdout, tqdm gets confused because … Read more