Mercurial > hg > bnpparibas
diff bnpparibas.py @ 13:37ce0dc68cad
Consider configuration parhs relartive to the configuration file location
author | Daniele Nicolodi <daniele@grinta.net> |
---|---|
date | Mon, 11 Jan 2016 21:39:40 +0100 |
parents | 4747393db602 |
children | 0a3509a12762 |
line wrap: on
line diff
--- a/bnpparibas.py Mon Jan 11 21:15:53 2016 +0100 +++ b/bnpparibas.py Mon Jan 11 21:39:40 2016 +0100 @@ -319,6 +319,13 @@ conffile = sys.argv[1] conf = loadconf(conffile) + datadir = os.path.dirname(conffile) + for key in 'DATABASE', 'GNUPGHOME': + # if path is not absolute, it is interpreted as relative + # to the location of the configuration file + if not os.path.isabs(conf[key]): + conf[key] = os.path.join(datadir, conf[key]) + db = sqlite3.connect(conf['DATABASE']) db.execute('''CREATE TABLE IF NOT EXISTS messages (id TEXT PRIMARY KEY)''') db.execute('''CREATE TABLE IF NOT EXISTS transactions (id INTEGER PRIMARY KEY)''')