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

Progressbars retain values when restarting #136

Closed
w4nderlust opened this Issue Aug 1, 2017 · 8 comments

Comments

Projects
None yet
3 participants
@w4nderlust

w4nderlust commented Aug 1, 2017

Description

If i finish and then restart a bar using AdaptiveETA, instead of showing the ETA the bar shows me the Time.

Code

import progressbar
import time

maximum = 50
widgets = [progressbar.FormatLabel('Bar'), "   ",
                       progressbar.Percentage(), " ",
                       progressbar.Bar(), " ",
                       progressbar.Timer(), " ",
                       progressbar.AdaptiveETA()]
bar = progressbar.ProgressBar(widgets=widgets,
                              max_value=maximum)

steps = 0
bar.start()
while steps < maximum:
	bar.update(steps)
	time.sleep(0.1)
	steps += 1
bar.finish()

time.sleep(0.2)

steps = 0
bar.start()
while steps < maximum:
	bar.update(steps)
	time.sleep(0.1)
	steps += 1
bar.finish()

Versions

  • Python version: 3.5.2
  • Python distribution/environment: Python
  • Operating System:Ubuntu 16.4
  • Package version: 3.30.2
@WoLpH

This comment has been minimized.

Show comment
Hide comment
@WoLpH

WoLpH Aug 3, 2017

Owner

Thanks for the bug report, I'm not 100% sure what would be the best way to solve it...

As a temporary workaround, the state can easily be reset with a: bar.extra = dict().
For the actual solution I'm afraid that might cause unexpected side effects for people (ab)using that feature for custom data... I'll have to do a bit more research I guess.

Owner

WoLpH commented Aug 3, 2017

Thanks for the bug report, I'm not 100% sure what would be the best way to solve it...

As a temporary workaround, the state can easily be reset with a: bar.extra = dict().
For the actual solution I'm afraid that might cause unexpected side effects for people (ab)using that feature for custom data... I'll have to do a bit more research I guess.

@w4nderlust

This comment has been minimized.

Show comment
Hide comment
@w4nderlust

w4nderlust Aug 3, 2017

Thanks for the answer. I tried the workaround, placing bar.extra = dict() both after the first finish and after the second start but in both cases it didn't work. Another possible workaround is to create a totally new bar, but that doesn't seem to be the best solution memory wise.

w4nderlust commented Aug 3, 2017

Thanks for the answer. I tried the workaround, placing bar.extra = dict() both after the first finish and after the second start but in both cases it didn't work. Another possible workaround is to create a totally new bar, but that doesn't seem to be the best solution memory wise.

@WoLpH

This comment has been minimized.

Show comment
Hide comment
@WoLpH

WoLpH Aug 3, 2017

Owner

No need to worry about that. Python will simply garbage collect the old bar and create a new one. Assuming you use the same variable of course :)

I've pushed a fix to the development branch for you to try, I believe it solves the issue and I'm hoping it won't cause issues for other users.

Owner

WoLpH commented Aug 3, 2017

No need to worry about that. Python will simply garbage collect the old bar and create a new one. Assuming you use the same variable of course :)

I've pushed a fix to the development branch for you to try, I believe it solves the issue and I'm hoping it won't cause issues for other users.

@WoLpH WoLpH closed this in ba44055 Aug 3, 2017

@WoLpH WoLpH changed the title from AdaptiveETA doesn't reset after restart to BUG: Progressbars retain values when restarting Aug 3, 2017

@WoLpH WoLpH changed the title from BUG: Progressbars retain values when restarting to Progressbars retain values when restarting Aug 3, 2017

WoLpH added a commit that referenced this issue Aug 3, 2017

Merge tag 'v3.34.0' into develop
Made progressbars reusable by default (#136) and added support for custom character width function (#137) v3.34.0
@w4nderlust

This comment has been minimized.

Show comment
Hide comment
@w4nderlust

w4nderlust Aug 4, 2017

Tested, it works just fine. Thank you really much for the super quick bugfix!

w4nderlust commented Aug 4, 2017

Tested, it works just fine. Thank you really much for the super quick bugfix!

@NicoHood

This comment has been minimized.

Show comment
Hide comment
@NicoHood

NicoHood Aug 5, 2017

@WoLpH If you do not create a github "release" and only a tag, I do not get a notification on a package update. You can leave it like this, but it would be nice of you can email me on a new release. see contact.nicohood.de

NicoHood commented Aug 5, 2017

@WoLpH If you do not create a github "release" and only a tag, I do not get a notification on a package update. You can leave it like this, but it would be nice of you can email me on a new release. see contact.nicohood.de

@WoLpH

This comment has been minimized.

Show comment
Hide comment
@WoLpH

WoLpH Aug 5, 2017

Owner

@NicoHood I can make Travis automatically (and safely) execute some code as soon as I add a new tag. For both of our convenience, what would be the best way to automate this?

I think I can make Travis automatically upload a release to Github as well: https://docs.travis-ci.com/user/deployment/releases/

Owner

WoLpH commented Aug 5, 2017

@NicoHood I can make Travis automatically (and safely) execute some code as soon as I add a new tag. For both of our convenience, what would be the best way to automate this?

I think I can make Travis automatically upload a release to Github as well: https://docs.travis-ci.com/user/deployment/releases/

@NicoHood

This comment has been minimized.

Show comment
Hide comment
@NicoHood

NicoHood Aug 5, 2017

Or you could manually tag the release with gpgit and also add the signature via github releases (instead of pypi). Do as you wish, it shouldnt be too complicated, its just that we are on the latest version. You can also flag the package out of date on the archlinux page.

NicoHood commented Aug 5, 2017

Or you could manually tag the release with gpgit and also add the signature via github releases (instead of pypi). Do as you wish, it shouldnt be too complicated, its just that we are on the latest version. You can also flag the package out of date on the archlinux page.

@WoLpH

This comment has been minimized.

Show comment
Hide comment
@WoLpH

WoLpH Aug 5, 2017

Owner

@NicoHood I tried gpgit after your initial request but it was a bit tricky to incorporate in my workflow which means that at some point or another I'll forget to use it and that would be bad ;)
I've made sure that travis automatically creates github releases whenever I create a tag so I believe that should solve the issue.

Owner

WoLpH commented Aug 5, 2017

@NicoHood I tried gpgit after your initial request but it was a bit tricky to incorporate in my workflow which means that at some point or another I'll forget to use it and that would be bad ;)
I've made sure that travis automatically creates github releases whenever I create a tag so I believe that should solve the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment