summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndré Glüpker <git@wgmd.de>2016-04-15 15:36:05 +0200
committerAndré Glüpker <git@wgmd.de>2016-04-15 15:36:05 +0200
commitd90be97c3744c90263eeebfba0ed8572125fd89e (patch)
tree71664f3db4faaaaf66c333f020695918604530bc
parent280d5a4222de687374486bf122e51c3bf9318f81 (diff)
download9kwpyqt-d90be97c3744c90263eeebfba0ed8572125fd89e.tar.gz
9kwpyqt-d90be97c3744c90263eeebfba0ed8572125fd89e.tar.bz2
9kwpyqt-d90be97c3744c90263eeebfba0ed8572125fd89e.zip
Close file descriptor after reading config
Thanks to https://github.com/hut/ranger/issues/529
-rwxr-xr-x9kwpyqt.py3
1 files changed, 2 insertions, 1 deletions
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