[projects/git-slug: 146/170] Print meaningful error message when problem with config is found
glen
glen at pld-linux.org
Mon Sep 21 21:51:05 CEST 2015
commit 574a867b382c78b60d8f46d25c32cd3acb6ff8c1
Author: Kacper Kornet <draenog at pld-linux.org>
Date: Wed Jul 25 05:59:05 2012 +0100
Print meaningful error message when problem with config is found
Usually the problem is caused by difference between locale setting which
are used to guess the config file encoding and the actual encoding of
the file.
slug.py | 5 +++++
1 file changed, 5 insertions(+)
---
diff --git a/slug.py b/slug.py
index 959ff18..fe09bb0 100755
--- a/slug.py
+++ b/slug.py
@@ -54,6 +54,11 @@ class ThreadFetch(threading.Thread):
def readconfig(path):
config = UnquoteConfig(delimiters='=', interpolation=None, strict=False)
config.read(path)
+ try:
+ config.read(path)
+ except UnicodeDecodeError:
+ raise SystemExit("I have problems parsing {} file.\n\
+Check if it is consistent with your locale settings.".format(path))
optionslist = {}
for option in ('newpkgs', 'prune'):
if config.has_option('PLD', option):
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/projects/git-slug.git/commitdiff/4ed64f73960519a2f4fd04c42950b2c96ae795c5
More information about the pld-cvs-commit
mailing list