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

tqdm didn't update on last iteration #1346

Open
6 tasks done
sugoides opened this issue Jul 29, 2022 · 1 comment
Open
6 tasks done

tqdm didn't update on last iteration #1346

sugoides opened this issue Jul 29, 2022 · 1 comment

Comments

@sugoides
Copy link

sugoides commented Jul 29, 2022

  • I have marked all applicable categories:
    • exception-raising bug
    • visual output bug
  • 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:
import tqdm, sys
mbar = tqdm(inputDir, leave=False, position=1)
for pptx in mbar:
         
        file = direc + pptx
        #tqdm.write(file)
        
        output = "./output/" + pptx[:-5]
        Presentation = Application.Presentations.Open(os.path.abspath(file))
        #Presentation.Slides[1].Export(os.path.abspath(output) +"1.jpg", "JPG", 800, 600);
        num = Presentation.Slides.count
        #print(num)
        com = num + com
        for i in tqdm(range(num), position=0):
            #tqdm.write(os.path.abspath(output)  + str(i) +".jpg")
            
            Presentation.Slides[i].Export(os.path.abspath(output)+ "-"  + str(i+1) +".jpg", "JPG", 1440, 1882)
            mbar.refresh()
        
        Presentation.close()
time.sleep(1)

although the process has finished the mbar did not update on the last iteration.

100%████████████████████████████████████████████████████████| 57/57 [00:25<00:00,  2.27it/s]
100%██████████████████████████████████████████████████████| 159/159 [01:08<00:00,  2.31it/s]
100%|███████████████████████████████████████████████████████| 106/106 [00:43<00:00,  2.43it/s]
100%|██████████████████████████████████████████████████████████| 63/63 [00:26<00:00,  2.37it/s]
 75%|████████████████████████████████████████▊                        | 3/4 [02:52<00:49, 49.92s/it]
 385```
[source website]: https://github.com/tqdm/tqdm/
[known issues]: https://github.com/tqdm/tqdm/#faq-and-known-issues
[issue tracker]: https://github.com/tqdm/tqdm/issues?q=
@mjpieters
Copy link

mjpieters commented Aug 25, 2023

I'm pretty sure this is the same issue as #1496. Could you see if my proposed fix (PR #1502) fixes this for you?

You can install the proposed changes locally with:

pip install git+https://github.com/tqdm/tqdm.git@refs/pull/1502/merge

Your sample code is not something complete enough to run locally, so I can't easily verify that this issue would be resolved with my PR.

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

2 participants