From 58b51a4b7761f5dae2fc46e7f8fda074ddf224e3 Mon Sep 17 00:00:00 2001 From: Florent Date: Wed, 18 Sep 2013 16:28:36 +0200 Subject: [PATCH] Print help instead of crash --- contrib/downloadboob/downloadboob.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/contrib/downloadboob/downloadboob.py b/contrib/downloadboob/downloadboob.py index 8943c954..389aacb5 100755 --- a/contrib/downloadboob/downloadboob.py +++ b/contrib/downloadboob/downloadboob.py @@ -217,7 +217,12 @@ class Downloadboob(object): config = ConfigParser.ConfigParser() config.read(['/etc/downloadboob.conf', os.path.expanduser('~/downloadboob.conf'), 'downloadboob.conf']) -links_directory=os.path.expanduser(config.get('main','directory', '.')) +try: + links_directory=os.path.expanduser(config.get('main','directory', '.')) +except ConfigParser.NoSectionError: + print "Please create a documentation file (see the README file and the downloadboob.conf example file)" + sys.exit(2) + links_directory=links_directory.decode('utf-8') download_directory=os.path.join(links_directory, DOWNLOAD_DIRECTORY)