Skip to content

Commit

Permalink
Fix ZeroDivisionError
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes11833 committed Nov 22, 2024
1 parent 8392241 commit 70f33be
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions rclone_python/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,7 @@ def extract_rclone_progress(line: str) -> Tuple[bool, Union[Dict[str, Any], None
except ValueError:
stats = None

# wait until we know the total file size --> bytes > 0
if stats is not None and stats.get("bytes", 0) > 0:
if stats is not None:
# get the progress of the individual files
tasks = []
for t in stats.get("transferring", []):
Expand All @@ -147,9 +146,7 @@ def extract_rclone_progress(line: str) -> Tuple[bool, Union[Dict[str, Any], None
"total": stats["totalBytes"],
"sent": stats["bytes"],
"progress": (
stats["bytes"] / stats["totalBytes"]
if stats["bytes"] is not None
else 0
stats["bytes"] / stats["totalBytes"] if stats["totalBytes"] != 0 else 0
),
"transfer_speed": stats["speed"],
"rclone_output": stats,
Expand Down

0 comments on commit 70f33be

Please sign in to comment.