Changeset 6852


Ignore:
Timestamp:
Apr 21, 2009, 1:48:38 PM (16 years ago)
Author:
rwilson
Message:

Added try/except to catch more download errors.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/utilities/system_tools.py

    r6834 r6852  
    332332
    333333    # We get here if there was a proxy error, get file through the proxy
    334 
    335 ## This code is how we might handle a proxy which doesn't use authentication
    336 ## CAN'T TEST THIS, SO NOT IMPLEMENTED
    337 ##    proxy = {'http': 'http://%s' % httpproxy}
    338 ##    try:
    339 ##        webget = urllib.urlopen(file_url, proxies=proxy)
    340 ##    else:
    341 ##        fd = open(file_name, 'wb')
    342 ##        while True:
    343 ##            data = webget.read(blocksize)
    344 ##            if len(data) == 0:
    345 ##                break
    346 ##            fd.write(data)
    347 ##        fd.close
    348 ##        webget.close()
    349 
    350334    # unpack auth info
    351335    try:
     
    392376    opener = urllib2.build_opener(proxy, authinfo, urllib2.HTTPHandler)
    393377    urllib2.install_opener(opener)
    394     webget = urllib2.urlopen(file_url)
     378    try:
     379        webget = urllib2.urlopen(file_url)
     380    except urllib2.HTTPError:
     381        return False
    395382
    396383    # transfer file to local filesystem
Note: See TracChangeset for help on using the changeset viewer.