1
0
Fork 0
mirror of https://github.com/Thor77/TeamspeakStats.git synced 2025-07-07 07:58:43 -04:00
TeamspeakStats/tsstats/config.py
2016-05-09 19:25:48 +02:00

22 lines
617 B
Python

from os.path import abspath
from tsstats.exceptions import InvalidConfig
try:
from configparser import ConfigParser
except ImportError:
from ConfigParser import ConfigParser
def parse_config(config_path):
config = ConfigParser()
config.read(config_path)
if not config.has_section('General') or not \
(config.has_option('General', 'logfile') and
config.has_option('General', 'outputfile')):
raise InvalidConfig
general = config['General']
log_path = abspath(general['logfile'])
output_path = abspath(general['outputfile'])
return log_path, output_path