From eb6abdf773def2a1282cc0b8584e56ee8101d404 Mon Sep 17 00:00:00 2001 From: Thomas Karl Pietrowski Date: Sat, 18 Jun 2016 14:07:14 +0200 Subject: [PATCH] Move f.close() into try: In case urlopen() fails, e.g. because of a missing internet connection, f will be indefined. --- plugins/SliceInfoPlugin/SliceInfo.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/SliceInfoPlugin/SliceInfo.py b/plugins/SliceInfoPlugin/SliceInfo.py index c97e436e06..7ca9e0241e 100644 --- a/plugins/SliceInfoPlugin/SliceInfo.py +++ b/plugins/SliceInfoPlugin/SliceInfo.py @@ -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()