1
From: David Paleino <d.paleino@gmail.com>
2
Subject: gracefully handle (and try to fix) configuration parsing errors
3
From time to time, it happens that an empty section "[]" is added to
4
wired-settings.conf. (Un)fortunately, RawConfigParser doesn't seem to
5
remove it with self.remove_section(""), but it automagically disappears
6
if the configfile is re-written again. Exceptions on errors are caught
7
if that was not the error.
8
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=553197
9
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=554949
13
wicd/configmanager.py | 15 ++++++++++++---
14
1 file changed, 12 insertions(+), 3 deletions(-)
16
--- wicd.orig/wicd/configmanager.py
17
+++ wicd/wicd/configmanager.py
18
@@ -24,7 +24,7 @@ reusable for other purposes as well.
19
# along with this program. If not, see <http://www.gnu.org/licenses/>.
22
-from ConfigParser import RawConfigParser
23
+from ConfigParser import RawConfigParser, ParsingError
25
from wicd.misc import Noneify, to_unicode
27
@@ -37,8 +37,17 @@ class ConfigManager(RawConfigParser):
28
self.config_file = path
30
self.mrk_ws = mark_whitespace
35
+ except ParsingError, e:
39
+ except ParsingError, p:
41
+ print "Could not start wicd: %s" % p.message
45
return self.config_file