IGN:Dont die if there is an error in a config file

This commit is contained in:
Kovid Goyal 2009-02-13 10:28:08 -08:00
parent 2cca07250b
commit b45437e56b

View File

@ -6,7 +6,7 @@ __docformat__ = 'restructuredtext en'
'''
Manage application-wide preferences.
'''
import os, re, cPickle, textwrap
import os, re, cPickle, textwrap, traceback
from copy import deepcopy
from functools import partial
from optparse import OptionParser as _OptionParser
@ -314,7 +314,12 @@ class OptionSet(object):
if not isinstance(src, unicode):
src = src.decode('utf-8')
if src is not None:
exec src in options
try:
exec src in options
except:
print 'Failed to parse options string:'
print repr(src)
traceback.print_exc()
opts = OptionValues()
for pref in self.preferences:
val = options.get(pref.name, pref.default)