Skip to content

external_write_mode doesn't clear instances on python 2 #727

@toddlipcon

Description

@toddlipcon

The following example script output is quite messed up on Python 2.7:

from tqdm import tqdm, trange
from time import sleep

for i in trange(10, desc='outer'):
  for j in trange(10, desc='inner'):
    # Print using tqdm class method .write()
    sleep(0.1)
    if not (j % 3):
        tqdm.write("Done task %i.%i" % (i,j))

The issue seems to be the code that locates other instances sharing the same underlying fp -- on Python 2, this gets wrapped by SimpleTextIOWrapper, so then the comparisons of the fps with each other and with stdout never succeed, and the 'clear' code doesn't execute.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions