Skip to content

tqdm_pandas() causes multiple lines to be printed in IDLE (Ubuntu 14.04, python2.7) #191

@ofir-reich

Description

@ofir-reich
>>> from tqdm import *
>>> import time
>>> # good
>>> for i in trange(10):
    time.sleep(0.2)


100%|██████████| 10/10 [00:02<00:00,  4.92it/s]
>>> # this will break things:
>>> tqdm_pandas(tqdm())
0it [00:00, ?it/s]
>>> for i in trange(10):
    time.sleep(0.2)



  0%|          | 0/10 [00:00<?, ?it/s]�[A
 10%|█         | 1/10 [00:00<00:01,  4.97it/s]�[A
 20%|██        | 2/10 [00:00<00:01,  4.90it/s]�[A
 30%|███       | 3/10 [00:00<00:01,  4.85it/s]�[A
 40%|████      | 4/10 [00:00<00:01,  4.84it/s]�[A
 50%|█████     | 5/10 [00:01<00:01,  4.84it/s]�[A
 60%|██████    | 6/10 [00:01<00:00,  4.83it/s]�[A
 70%|███████   | 7/10 [00:01<00:00,  4.82it/s]�[A
 80%|████████  | 8/10 [00:01<00:00,  4.83it/s]�[A
 90%|█████████ | 9/10 [00:01<00:00,  4.84it/s]�[A
100%|██████████| 10/10 [00:02<00:00,  4.84it/s]�[A
�[A

After running tqdm_pandas(tqdm()).
Some strange characters are printed instead of the carriage return action.
Running tqdm_pandas(tqdm()) again creates more of these strange characters and new lines:

>>> tqdm_pandas(tqdm())


0it [00:00, ?it/s]�[A�[A
>>> for i in trange(10):
    time.sleep(0.2)





  0%|          | 0/10 [00:00<?, ?it/s]�[A�[A�[A


 10%|█         | 1/10 [00:00<00:01,  4.98it/s]�[A�[A�[A


 20%|██        | 2/10 [00:00<00:01,  4.93it/s]�[A�[A�[A


 30%|███       | 3/10 [00:00<00:01,  4.89it/s]�[A�[A�[A


 40%|████      | 4/10 [00:00<00:01,  4.87it/s]�[A�[A�[A


 50%|█████     | 5/10 [00:01<00:01,  4.84it/s]�[A�[A�[A


 60%|██████    | 6/10 [00:01<00:00,  4.83it/s]�[A�[A�[A


 70%|███████   | 7/10 [00:01<00:00,  4.83it/s]�[A�[A�[A


 80%|████████  | 8/10 [00:01<00:00,  4.78it/s]�[A�[A�[A


 90%|█████████ | 9/10 [00:01<00:00,  4.75it/s]�[A�[A�[A


100%|██████████| 10/10 [00:02<00:00,  4.78it/s]�[A�[A�[A


�[A�[A�[A

This only happens in IDLE. When I try the python in Shell it behaves fine (except that it stays there after the loop is over).

Thanks for the amazing project!

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalid ⛔Not-an-issue or upstream (not-our-issue)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions