[GRASS-SVN] r38104 - grass/branches/develbranch_6/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Jun 27 15:31:18 EDT 2009


Author: martinl
Date: 2009-06-27 15:31:18 -0400 (Sat, 27 Jun 2009)
New Revision: 38104

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/prompt.py
Log:
wxGUI: don't crash when history file is missing
       (merge from trunk, r38103)


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/prompt.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/prompt.py	2009-06-27 19:27:38 UTC (rev 38103)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/prompt.py	2009-06-27 19:31:18 UTC (rev 38104)
@@ -386,9 +386,16 @@
     def SetHistoryItems(self):
         """!Read history file and update combobox items"""
         env = grass.gisenv()
-        fileHistory = open(os.path.join(env['GISDBASE'], env['LOCATION_NAME'], env['MAPSET'],
-                                        '.bash_history'), 'r')
         try:
+            fileHistory = open(os.path.join(env['GISDBASE'],
+                                            env['LOCATION_NAME'],
+                                            env['MAPSET'],
+                                            '.bash_history'), 'r')
+        except IOError:
+            self.SetItems([])
+            return
+        
+        try:
             hist = []
             for line in fileHistory.readlines():
                 hist.append(line.replace('\n', ''))



More information about the grass-commit mailing list