diff options
Diffstat (limited to 'lorry')
-rwxr-xr-x | lorry | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -808,8 +808,8 @@ class Lorry(cliapp.Application): new_files[src] = file_dest self.progress('.. attempting to fetch %s' % basename) try: - with open(file_dest, 'wb') as raw_file: - urlfile = urllib.request.urlopen(url) + with open(file_dest, 'wb') as raw_file, \ + urllib.request.urlopen(url) as urlfile: raw_file.write(urlfile.read()) try: # HTTP dates use (one of) the email date formats @@ -818,7 +818,6 @@ class Lorry(cliapp.Application): urlfile.info()['Last-Modified'])) except (KeyError, ValueError, TypeError): url_date = None - urlfile.close() if url_date: os.utime(file_dest, (url_date, url_date)) except Exception: |