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
This commit is contained in:
Joshua Harlow 2014-04-29 17:41:41 -07:00
parent 1d6b0fd881
commit b3ea5cf5e2
1 changed files with 2 additions and 1 deletions

View File

@ -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