summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2013-06-16 14:50:04 +0200
committermathieui <mathieui@mathieui.net>2013-06-16 14:50:04 +0200
commitc8700dd06e593f240f9fa43c6e6f73aae05a593c (patch)
tree0b0df1160af2f9471715304b6afde7a2cf6de829
parent356d8a218445fc9037e69c6e6b6156f49e839b1c (diff)
downloadpoezio-c8700dd06e593f240f9fa43c6e6f73aae05a593c.tar.gz
poezio-c8700dd06e593f240f9fa43c6e6f73aae05a593c.tar.bz2
poezio-c8700dd06e593f240f9fa43c6e6f73aae05a593c.tar.xz
poezio-c8700dd06e593f240f9fa43c6e6f73aae05a593c.zip
Fail properly when the config can’t be parsed.
-rw-r--r--src/config.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/config.py b/src/config.py
index 695362e5..92fa503f 100644
--- a/src/config.py
+++ b/src/config.py
@@ -13,6 +13,7 @@ from/to the config file
DEFSECTION = "Poezio"
from gettext import gettext as _
+import sys
import logging
log = logging.getLogger(__name__)
@@ -259,4 +260,10 @@ if not path.isfile(options.filename):
copy2(other, options.filename)
firstrun = True
-config = Config(options.filename)
+try:
+ config = Config(options.filename)
+except:
+ import traceback
+ sys.stderr.write('Poezio was unable to read or parse the config file.\n')
+ traceback.print_exc(limit=0)
+ sys.exit(1)