question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ERROR: float division by zero

See original GitHub issue

Hey, I’ve noticed that I often get a divide by zero error when trying to download files. It appears the code does not handle the case when cur_time - beg_time is 0

Traceback (most recent call last):
  File "downloader-cli\0.3.1\downloader_cli\download.py", line 376, in _download
    speed, s_unit, time_left, time_unit = self._get_speed_n_time(
  File "downloader-cli\0.3.1\downloader_cli\download.py", line 264, in _get_speed_n_time
    speed = (file_size_dl / 1024) / (cur_time - beg_time)
ZeroDivisionError: float division by zero

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jcwilloxcommented, Jan 23, 2021

@deepjyoti30 yep that’s fixed the issue, thanks for sorting this out so quickly 👍

0reactions
deepjyoti30commented, Jan 23, 2021

@ChanceNCounter Cool then, let’s keep the conditional for now. If that seems to throw issues, we can consider the sleep one as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ZeroDivisionError: float division by zero in Python | bobbyhadz
The Python "ZeroDivisionError: float division by zero" occurs when we try to divide a floating-point number by 0 . To solve the error,...
Read more >
ZeroDivisionError: division by zero - Net-Informations.Com
ZeroDivisionError is a built-in Python exception thrown when a number is divided by 0. This means that the exception raised when the second...
Read more >
float division by zero Python - decimal - Stack Overflow
If n is a large number then use double or decimal instead of float. It will solve division by zero issue. Updated: Here...
Read more >
Python error ZeroDivisionError float division by zero - Edureka
In the above line the denominator becomes zero. A float number cannot be devided by zero. In this case the express is divided...
Read more >
Floating-Point Division by Zero Error Message - MultiCharts
Floating point error means that there is a division by a zero value in your code. It can be a variable, input, or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found