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:
parent
1d6b0fd881
commit
b3ea5cf5e2
@ -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…
x
Reference in New Issue
Block a user