From 80013af81411def8cfe8e0313250c1b176dd61d9 Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Mon, 29 Apr 2019 21:33:20 +0200 Subject: [PATCH] If config does not exist we exit and tell user to follow readme --- transAtlanticTorrentExpress.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/transAtlanticTorrentExpress.py b/transAtlanticTorrentExpress.py index 3380664..d13c032 100755 --- a/transAtlanticTorrentExpress.py +++ b/transAtlanticTorrentExpress.py @@ -2,13 +2,17 @@ import os, sys from subprocess import check_output, Popen, PIPE from configparser import ConfigParser -print('test') def getConfig(): print('Reading config') - config = ConfigParser() pwd = os.path.dirname(os.path.abspath(__file__)) path = os.path.join(pwd, 'config.ini') + + if not os.path.isfile(path): + print('Please fill out and rename config file. Check README for more info.') + exit(0) + + config = ConfigParser() config.read(path) print('Sections parsed: {}'.format(config.sections()))