added try for reading config file
This commit is contained in:
@@ -71,8 +71,11 @@ cwd = os.path.dirname(os.path.realpath(__file__))
|
|||||||
# import the config file
|
# import the config file
|
||||||
logger.debug("Starting to read the ini config.")
|
logger.debug("Starting to read the ini config.")
|
||||||
logger.debug("Using file {0}/config.ini.".format(cwd))
|
logger.debug("Using file {0}/config.ini.".format(cwd))
|
||||||
|
try:
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.read(cwd + '/config.ini')
|
config.read(cwd + '/config.ini')
|
||||||
|
except ValueError:
|
||||||
|
logger.critical("Unable to find/read config file. ")
|
||||||
|
|
||||||
serverDNS = config['LDAP SERVER']['server']
|
serverDNS = config['LDAP SERVER']['server']
|
||||||
serverPort = config['LDAP SERVER'].getint('port')
|
serverPort = config['LDAP SERVER'].getint('port')
|
||||||
|
|||||||
Reference in New Issue
Block a user