Closed EricPostMaster closed 4 years ago
It seems like the problem might be
if count == 0:
progress_size = 0
start_time = time.time() # Time starts counting from zero
return
duration = time.time() - start_time # If duration is first calculated in the same second as start_time, speed (below) will divide by zero and return an error
progress_size += block_size
if progress_size >= total_size:
progress_size = total_size
speed = progress_size / (1024 * duration) # Error if duration is calculated in same second as start_time
I'm looking at datetime.time() right now to see if we can use microseconds instead...
@EricPostMaster I have just fixed this on master https://github.com/thisiscam/math-with-slack/blob/master/math-with-slack.py#L369 and https://github.com/thisiscam/math-with-slack/blob/master/math-with-slack.py#L375
Try catch might not be necessary here but it avoids problems :) Let me know if this is working for you!
@thisiscam - Looks great! I have never used try/except, so I'm glad to see your solution.
I am new to this, so is there a way for me to test the fix now that I have math-with-slack installed on my computer? Or do I need to uninstall it and reinstall with the new master?
Working like a charm. Closing issue.
It took me three tries to run the script and download MathJax. The first two times I got this error:
For some reason, it just worked on the third attempt even though I didn't do anything differently. I don't know what caused the error, but until it's solved I think it would be good to add a note to the README.md to help new users troubleshoot.