Enrique Fernandez commited on
Commit
f709dd0
·
1 Parent(s): 55c1f36

Fix division by zero

Browse files
Files changed (1) hide show
  1. pytube/utils.py +5 -3
pytube/utils.py CHANGED
@@ -79,7 +79,9 @@ def print_status(progress, file_size, start):
79
 
80
  percentDone = int(progress) * 100. / file_size
81
  done = int(50 * progress / int(file_size))
82
- stdout.write("\r [%s%s][%3.2f%%] %s at %s/s\r " %
83
- ('=' * done, ' ' * (50 - done), percentDone, sizeof(file_size),
84
- sizeof(progress // (clock() - start))))
 
 
85
  stdout.flush()
 
79
 
80
  percentDone = int(progress) * 100. / file_size
81
  done = int(50 * progress / int(file_size))
82
+ dt = (clock() - start)
83
+ if dt > 0:
84
+ stdout.write("\r [%s%s][%3.2f%%] %s at %s/s\r " %
85
+ ('=' * done, ' ' * (50 - done), percentDone, sizeof(file_size),
86
+ sizeof(progress // dt)))
87
  stdout.flush()