Commits

Philip Jenvey committed 262a2ce

actually close files

Comments (0)

Files changed (1)

             try:
                 fp = self.open_local_file(url1)
                 hdrs = fp.info()
-                del fp
+                fp.close()
                 return url2pathname(splithost(url1)[1]), hdrs
             except IOError, msg:
                 pass
                 tfp.close()
         finally:
             fp.close()
-        del fp
-        del tfp
 
         # raise exception if actual size does not match content-length header
         if size >= 0 and read < size:
                 print '======'
                 for k in h.keys(): print k + ':', h[k]
                 print '======'
-            fp = open(fn, 'rb')
-            data = fp.read()
-            del fp
+            with open(fn, 'rb') as fp:
+                data = fp.read()
             if '\r' in data:
                 table = string.maketrans("", "")
                 data = data.translate(table, "\r")