Skip to content

Commit

Permalink
Improve portability with tqdm versions
Browse files Browse the repository at this point in the history
  • Loading branch information
desbma committed Jun 2, 2019
1 parent 942ca7e commit 2ea0197
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion amg/ytdl_tqdm.py
Expand Up @@ -61,7 +61,12 @@ def _log_progress(self, ytdl_state):
# update state
if self.prev_downloaded_bytes > downloaded_bytes:
# new YoutubeDL file, reset progress bar
self.tqdm.reset()
try:
self.tqdm.reset()
except AttributeError:
# tqdm < 4.32.0
self.tqdm.close()
self.tqdm = self._get_new_tqdm()
newly_downloaded_bytes = downloaded_bytes
else:
newly_downloaded_bytes = downloaded_bytes - self.prev_downloaded_bytes
Expand Down

0 comments on commit 2ea0197

Please sign in to comment.