[GRASS-SVN] r32335 - grass/trunk/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Jul 27 12:34:51 EDT 2008
Author: martinl
Date: 2008-07-27 12:34:51 -0400 (Sun, 27 Jul 2008)
New Revision: 32335
Modified:
grass/trunk/gui/wxpython/gui_modules/preferences.py
Log:
wxGUI: don't crash when unable to read settings file
Modified: grass/trunk/gui/wxpython/gui_modules/preferences.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/preferences.py 2008-07-27 16:17:52 UTC (rev 32334)
+++ grass/trunk/gui/wxpython/gui_modules/preferences.py 2008-07-27 16:34:51 UTC (rev 32335)
@@ -523,6 +523,7 @@
try:
file = open(filename, "r")
+ line = ''
for line in file.readlines():
line = line.rstrip('%s' % os.linesep)
group, key = line.split(self.sep)[0:2]
@@ -541,9 +542,14 @@
value = self.__parseValue(value, read=True)
self.Append(settings, group, key, subkey, value)
idx += 2
- finally:
+ except ValueError, e:
+ print >> sys.stderr, _("Error: Reading settings from file <%s> failed.\n"
+ " Details: %s\n"
+ " Line: '%s'") % (filename, e, line)
file.close()
+ file.close()
+
def SaveToFile(self, settings=None):
"""Save settings to the file"""
if settings is None:
More information about the grass-commit
mailing list