Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

download_checkmd5 ContentTooShortError #559

Closed
bricerebsamen opened this issue Dec 11, 2013 · 5 comments
Closed

download_checkmd5 ContentTooShortError #559

bricerebsamen opened this issue Dec 11, 2013 · 5 comments

Comments

@bricerebsamen
Copy link

Hi

I'm using download_checkmd5.py to download a 200MB file from my server, and it always seems to fail with a ContentTooShortError. My server is quite reliable though: using wget I have no issues at all downloading the file.

I tried using urllib2 but it's the same.

def dlfile(url, dest):
    # Open the url
    f = urllib2.urlopen(url)

    # Open our local file for writing
    with open(dest, "wb") as local_file:
        local_file.write(f.read())

I am now working on a solution using wget...

any idea?

Brice

@tfoote
Copy link
Member

tfoote commented Dec 11, 2013

Some auto retry logic could be added. Wget defaults to 20 retries. http://www.gnu.org/software/wget/manual/html_node/Download-Options.html

@dirk-thomas
Copy link
Member

In order to work reliably the code would need logic to resume a previously aborted download. It could e.g. use PyCurl for this (see http://stackoverflow.com/questions/4533304/python-urlretrieve-limit-rate-and-resume-partial-download).

A pull request for this would be welcome 😄

@wjwwood
Copy link
Member

wjwwood commented Dec 11, 2013

I believe this stackoverflow is talking about this issue and how you might implement this behavior with Python's urllib:

http://stackoverflow.com/questions/6963283/python-urllib2-resume-download-doesnt-work-when-network-reconnects

@bricerebsamen
Copy link
Author

@dirk-thomas OK I'm starting on it

@dirk-thomas
Copy link
Member

One comment regarding the code @wjwwood referenced: it does not check if the server actually support the range header. It should do that in order not to stitch together wrong parts of the downloaded file.

dirk-thomas added a commit that referenced this issue Jan 7, 2014
update download script to resume downloads when server supports it (fix #559)
@dirk-thomas dirk-thomas modified the milestone: untargeted May 27, 2014
cwecht pushed a commit to cwecht/catkin that referenced this issue Mar 20, 2018
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

No branches or pull requests

4 participants