I'm guessing that windows time.time() doesn't have the precision of linux.
When sync doesn't download anything (no files have changed), time_elapsed
can be zero, causing a divide by zero error when determining the download
speed.
See code in cmd_sync_remote2local() below. I added the debug statements and
a workaround fix.
total_elapsed = time.time() - timestamp_start
#if total_elapsed == 0:
# total_elapsed = 0.001
debug(u"time.time(): %f" % time.time())
debug(u"timstamp_start: %f" % timestamp_start)
debug(u"total_elapsed: %f" % total_elapsed)
speed_fmt = formatSize(total_size/total_elapsed, human_readable = True,
floating_point = True)
# Only print out the result if any work has been done or
# if the user asked for verbose output
outstr = "Done. Downloaded %d bytes in %0.1f seconds, %0.2f %sB/s" %
(total_size, total_elapsed, speed_fmt[0], speed_fmt[1])
if total_size > 0:
output(outstr)
else:
info(outstr)
>From running in debug mode:
INFO: Summary: 0 remote files to download, 6 local files to delete
DEBUG: time.time(): 1294942275.279000
DEBUG: timstamp_start: 1294942275.279000
DEBUG: total_elapsed: 0.000000
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
An unexpected error has occurred.
Please report the following lines to:
s3tools-bugs@...
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Problem: ZeroDivisionError: float division by zero
S3cmd: 1.0.0
Traceback (most recent call last):
File "C:\Python27\Scripts\s3cmd.py", line 2011, in <module>
main()
File "C:\Python27\Scripts\s3cmd.py", line 1955, in main
cmd_func(args)
File "C:\Python27\Scripts\s3cmd.py", line 1218, in cmd_sync
return cmd_sync_remote2local(args)
File "C:\Python27\Scripts\s3cmd.py", line 1061, in cmd_sync_remote2local
speed_fmt = formatSize(total_size/total_elapsed, human_readable = True,
floa
ting_point = True)
ZeroDivisionError: float division by zero
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
An unexpected error has occurred.
Please report the above lines to:
s3tools-bugs@...
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
--
Chris Chalfant
Cycle Computing, LLC
phone: 317.572.7390
twitter: @chalfant
skype: cycle.chris.chalfant
|