diff options
author | Dirk Mallunat <s4msung@exigen.org> | 2016-07-05 00:09:20 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2016-07-05 00:19:07 +0200 |
commit | 29634278eb84fcdd1b29b85ed2ce8c5250e4a183 (patch) | |
tree | ccf730e10728e1fac05bae6d7937be540d3f1c88 /fb.py | |
parent | 5455b5edefd5f1d6b99ca5f5d1b9d471df25045b (diff) |
Close config file
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'fb.py')
-rwxr-xr-x | fb.py | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -385,10 +385,11 @@ class ConfigParser: if ignoreMissing: return - for line in fh.readlines(): - matches = re.match('^(?P<key>[^=]+)=(?P<quotechar>"?)(?P<value>.+)(?P=quotechar)$', line) - if matches != None: - self.config[matches.group('key')] = matches.group('value') + with fh: + for line in fh: + matches = re.match('^(?P<key>[^=]+)=(?P<quotechar>"?)(?P<value>.+)(?P=quotechar)$', line) + if matches != None: + self.config[matches.group('key')] = matches.group('value') def get_config(self): return self.config |