Skip to content

Conversation

@FurongPeng
Copy link

If the time span between two calls of print_status is too small, the current position is not correct.
For example:

from eta import ETA
import time
eta = ETA(100)
for i in xrange(100):
eta.print_status(overwrite=False)
time.sleep(0.01)
eta.done()

the output is :

1.0% | 0:00 [> ] ETA:
2.0% / 0:00 [> ] ETA:
3.0% - 0:00 [> ] ETA:
4.0% \ 0:00 [> ] ETA:
5.0% | 0:00 [=> ] ETA:
Done! (0:01)

If we replace eta.print_status(overwrite=False) with eta.print_status(i,overwrite=False) then it we can get the correct output.

0.0% | 0:00 [> ] ETA:
20.0% / 0:00 [====> ] ETA:
40.0% - 0:00 [========> ] ETA:
60.0% \ 0:00 [============> ] ETA:
80.0% | 0:00 [================> ] ETA:
Done! (0:01)

In ETA, I think the variable i is used for holding current position. So, I make the variable i to keep the correct position.

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

Successfully merging this pull request may close these issues.

1 participant