Commit fce80a48 authored by Adam Caprez's avatar Adam Caprez
Browse files

Set `conn` to None before try/except/finally block

Make sure the `conn` variable exists, otherwise a `urllib2.URLError`
exception causes a subsequent `UnboundLocalError` in the `finally`
parent 46a68c5b
......@@ -20,6 +20,7 @@ def downloadFile(url, localpath, urltype="ftp://", retries=3, overwrite=True, ch
if not os.path.isfile(localpath) or overwrite:
for i in range(0, retries):
print "Attempt #%s, downloading %s\n" % (i + 1, url)
conn = None
hash_md5 = hashlib.md5()
conn = urllib2.urlopen(urltype + url)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment