Move f.close() into try:

In case urlopen() fails, e.g. because of a missing internet connection,
f will be indefined.
This commit is contained in:
Thomas Karl Pietrowski 2016-06-18 14:07:14 +02:00
parent 8f450d0d2f
commit eb6abdf773

View file

@ -99,7 +99,6 @@ class SliceInfo(Extension):
try:
f = urllib.request.urlopen(self.info_url, data = binary_data, timeout = 1)
Logger.log("i", "Sent anonymous slice info to %s", self.info_url)
f.close()
except Exception as e:
Logger.logException("e", e)
f.close()