Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
3 tasks done
lust4life opened this issue Jul 19, 2018 · 2 comments
Open
3 tasks done
Assignees

Comments

@lust4life
Copy link

lust4life commented Jul 19, 2018

  • 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?

@chengs
Copy link
Contributor

chengs commented Jul 23, 2018

eh, IMHO, tqdm.write is used to replace print. Imagine you are using print in multiprocessing mode: you can not control the sequence of the content of print. So it is the same for tqdm.write.

@casperdcl casperdcl self-assigned this May 9, 2019
@CentralLT
Copy link

There is no activity for 1 year and the write vs. print issue is migrated into issue #737. So lets close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants