Skip to content

manual control over positioning not working when work with tqdm.write #578

@lust4life

Description

@lust4life
  • I have visited the source website, and in particular
    read the known issues

  • I have searched through the issue tracker for duplicates

  • I have mentioned version numbers, operating system and
    environment, where applicable:

    4.23.4 3.6.5 |Anaconda custom (64-bit)| (default, Apr 26 2018, 08:42:37)
    [GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] darwin

from time import sleep
from tqdm import trange, tqdm
from multiprocessing import Pool, freeze_support, RLock

L = list(range(9))

def progresser(n):
    interval = 0.001 / (n + 2)
    total = 5000
    text = "#{}, est. {:<04.2}s".format(n, interval * total)
    for i in trange(total, desc=text, position=n):

        tqdm.write("look at here....")

        sleep(interval)

if __name__ == '__main__':
    freeze_support()  # for Windows support
    p = Pool(len(L),
             # again, for Windows support
             initializer=tqdm.set_lock, initargs=(RLock(),))
    p.map(progresser, L)
    print("\n" * (len(L) - 2))

tqdm.write("look at here....") notice here

the demo code in README doesn't work when integrate with tqdm.write, any solution here?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions