Skip to content

Conversation

@gdh1995
Copy link
Contributor

@gdh1995 gdh1995 commented Nov 10, 2015

Sometimes urllib calls a hook the first time and then the second in a time distance too shorter than 1 second, in which case download_model_binary.py will break. This commit fixes this crash.

Extra information:

  • When I ran scripts/download_model_binary.py to download caffe model, it once reported;
Traceback (most recent call last):
  File "***/caffe\scripts/download_model_binary.py", line 73, in <module>
    frontmatter['caffemodel_url'], model_filename, reporthook)
  File "d:\Python27\lib\urllib.py", line 93, in urlretrieve
    return _urlopener.retrieve(url, filename, reporthook, data)
  File "d:\Python27\lib\urllib.py", line 274, in retrieve
    reporthook(blocknum, bs, size)
ZeroDivisionError: float division by zero
  • I saw the output file and found the count was about 6 KB.
  • Windows 8.1 Pro x64, Python 2.7 (32 bits) with urllib-1.17

shelhamer added a commit that referenced this pull request Dec 2, 2015
don't divide by 0 duration when downloading model binary
@shelhamer shelhamer merged commit fe3abd0 into BVLC:master Dec 2, 2015
@shelhamer
Copy link
Member

Thanks -- this doesn't seem like a common issue but it doesn't hurt to avoid it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants