From dba5bcf4c921dfe24e8ded739349efaad138ccd6 Mon Sep 17 00:00:00 2001 From: Martin Brodbeck Date: Wed, 18 Sep 2013 15:20:47 +0200 Subject: [PATCH] Check if settings.ini is available --- radiorec.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/radiorec.py b/radiorec.py index 5fa5fec..71c3613 100755 --- a/radiorec.py +++ b/radiorec.py @@ -47,7 +47,12 @@ def read_settings(): settings_base_dir = os.getenv('LOCALAPPDATA') + os.sep + 'radiorec' settings_base_dir += os.sep config = configparser.ConfigParser() - config.read(settings_base_dir + 'settings.ini') + try: + config.read_file(open(settings_base_dir + 'settings.ini')) + except FileNotFoundError as err: + print(str(err)) + print('Please copy/create the settings file to/in the appropriate location.') + sys.exit() return dict(config.items()) def record_worker(stoprec, streamurl, target_dir, args):