[tftpy-general] issue with divide by zero in tptpy-client.py
Status: Beta
Brought to you by:
msoulier
|
From: Vanheesbeke S. <Ste...@va...> - 2008-05-17 22:23:27
|
Hi,
When doing some file transfers with very small files (few bytes), a divide by zero exception occurs when calculating the transfer rate.
Easy fix at the end of the download function :
if duration == 0:
logger.info("Average rate not determined")
else:
bps = (self.bytes * 8.0) / duration
kbps = bps / 1024.0
logger.info("Average rate: %.2f kbps" % kbps)
Instead of the last 3 lines of code.
When using the patch to download files (from Lorenz Schori), this must be changed in the upload function to.
Stefaan
|