I'm redirecting the stdout and stderr streams from a Python script to a file. Before redirecting, I was using the tqdm progress bar in my script which continually updates the bar in the same place in the console. However, after redirecting, in the file each update is printed to a new line:
0%| | 0/1369 [00:00<?, ?it/s]
0%| | 1/1369 [00:00<08:40, 2.63it/s]
0%| | 2/1369 [00:00<08:03, 2.82it/s]
0%| | 3/1369 [00:00<07:35, 3.00it/s]
0%| | 4/1369 [00:01<07:15, 3.14it/s]
0%| | 5/1369 [00:01<07:52, 2.89it/s]
0%| | 6/1369 [00:01<07:26, 3.05it/s]
1%| | 7/1369 [00:02<07:08, 3.18it/s]
1%| | 8/1369 [00:02<06:55, 3.28it/s]
1%| | 9/1369 [00:02<06:46, 3.35it/s]
1%| | 10/1369 [00:03<06:39, 3.40it/s]
1%| | 11/1369 [00:03<06:35, 3.43it/s]
1%| | 12/1369 [00:03<06:32, 3.46it/s]
1%| | 13/1369 [00:03<06:29, 3.48it/s]
1%| | 14/1369 [00:04<06:28, 3.49it/s]
Is there a way to write tqdm output (or any other progress bar) to a file which stays on the same line?