From d90be97c3744c90263eeebfba0ed8572125fd89e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Gl=C3=BCpker?= Date: Fri, 15 Apr 2016 15:36:05 +0200 Subject: Close file descriptor after reading config Thanks to https://github.com/hut/ranger/issues/529 --- 9kwpyqt.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/9kwpyqt.py b/9kwpyqt.py index aceff68..680ceee 100755 --- a/9kwpyqt.py +++ b/9kwpyqt.py @@ -337,7 +337,8 @@ class CaptchaGUI(QWidget): defaultconfig['Autostart'] = 'no' self.config = configparser.ConfigParser(defaultconfig) try: - self.config.read_file(open('9kwpyqt.ini')) + with open('9kwpyqt.ini') as configfile: + self.config.read_file(configfile) except FileNotFoundError: self.writeConfig() return False -- cgit v1.2.3