Browse Source

Read using a file handle instead of read() method

The read() method silently ignores errors which is
not so useful if .gerttyrc doesn't exist, so instead
of using that use the readfp which will open the file
and then correctly read from the file (and raise if
the file does not exist).

Change-Id: I3bf68408595e06c6ffb60632b46995c1fadbea3f
changes/91/391991/1
Joshua Harlow 8 years ago
parent
commit
b3ea5cf5e2
  1. 3
      gertty/config.py

3
gertty/config.py

@ -22,7 +22,8 @@ class Config(object):
def __init__(self, server=None, path=DEFAULT_CONFIG_PATH):
self.path = os.path.expanduser(path)
self.config = ConfigParser.RawConfigParser()
self.config.read(self.path)
with open(self.path, 'r') as f:
self.config.readfp(f, filename=f.name)
if server is None:
server = self.config.sections()[0]
self.server = server

Loading…
Cancel
Save