Commit dc04e180 authored by marc0s's avatar marc0s

Fix config file argument parsing

parent ab48742d
......@@ -29,9 +29,6 @@ from datetime import datetime
import feedparser
import statusnet
LIT_FILE = "/home/marcos/.rss2sn_tstamp"
DATE_FORMAT = "%a, %d %b %Y %H:%M:%S"
PARSER = argparse.ArgumentParser(description=__doc__)
PARSER.add_argument('--CONFIG', '-c', dest='CONFIG', type=str,
help='The CONFIGuration file')
......@@ -57,15 +54,13 @@ ARGS = PARSER.parse_args()
CONFIG = ConfigParser.ConfigParser()
CFGFILES = [os.path.expanduser('~/.rss2sn.cfg')]
try:
if ARGS.CONFIG:
CFGFILES.insert(0, ARGS.CONFIG)
CONFIG.read(CFGFILES)
except IOError:
raise IOError("No CONFIG file available")
if ARGS.CONFIG:
CFGFILES = [ARGS.CONFIG]
if not CONFIG.read(CFGFILES):
raise Exception("No configuration file found!")
if not CONFIG.has_section(ARGS.account):
raise Exception("The given account has no CONFIGuration available!")
raise Exception("The given account has no configuration available!")
SECTION = ARGS.account
try:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment