Added exception handling for bad files or missing files

This commit is contained in:
echel0n 2014-04-01 19:04:38 -07:00
commit c49fb9586f

View file

@ -28,8 +28,14 @@ class config(ConfigParser.ConfigParser):
MissingSectionHeaderError = ConfigParser.MissingSectionHeaderError MissingSectionHeaderError = ConfigParser.MissingSectionHeaderError
def __init__(self, *file): def __init__(self, *file):
ConfigParser.ConfigParser.__init__(self) try:
self.optionxform = str ConfigParser.ConfigParser.__init__(self)
if not file: self.optionxform = str
file = CONFIG_FILE if not file:
self.read(file) file = CONFIG_FILE
if self.read(file):
pass
else:
raise self.Error('Cannot open configuration file')
except IOError, error:
exit(error)