From 930b7dc57bb9069b1960b2c538c18bb6773f0573 Mon Sep 17 00:00:00 2001 From: Adam Blackburn Date: Sat, 29 May 2010 17:32:35 +0800 Subject: [PATCH] Debian patch: 06-dont_bomb_out_on_configparser_error.patch --- wicd/configmanager.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/wicd/configmanager.py b/wicd/configmanager.py index 430cbb5..0dee326 100644 --- a/wicd/configmanager.py +++ b/wicd/configmanager.py @@ -26,7 +26,7 @@ reusable for other purposes as well. import os, copy -from ConfigParser import RawConfigParser +from ConfigParser import RawConfigParser, ParsingError from wicd.misc import Noneify, to_unicode @@ -39,8 +39,17 @@ class ConfigManager(RawConfigParser): self.config_file = path self.debug = debug self.mrk_ws = mark_whitespace - self.read(path) - + try: + self.read(path) + except ParsingError, e: + self.write() + try: + self.read(path) + except ParsingError, p: + import sys + print "Could not start wicd: %s" % p.message + sys.exit(1) + def __repr__(self): return self.config_file