catch get exception in cfgfile, not in other places

This commit is contained in:
Marcus Stoegbauer 2019-07-03 23:05:04 +02:00
parent a029c096c8
commit 24c51481dc
2 changed files with 5 additions and 3 deletions

View File

@ -11,7 +11,6 @@ import configparser
import os
import re
class Conf(object):
confobj = configparser.RawConfigParser()
cfgfile = ''
@ -57,7 +56,10 @@ class Conf(object):
"""
if not self.cfgfile:
raise Exception('No config file set')
try:
return self.confobj.get(section, option)
except configparser.NoOptionError:
raise ValueError('Option does not exist')
def set(self, section, option, value):
"""docstring for update"""

View File

@ -85,7 +85,7 @@ def workdir(directory):
reverse_sort = False
try:
reverse_sort = (dir_config.get("Main", "reverse") == 'True')
except NoOptionError:
except ValueError:
reverse_sort = False