[GRASS-SVN] r43820 - grass/trunk/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Oct 7 07:11:23 EDT 2010


Author: martinl
Date: 2010-10-07 11:11:23 +0000 (Thu, 07 Oct 2010)
New Revision: 43820

Modified:
   grass/trunk/gui/wxpython/gui_modules/goutput.py
Log:
wxGUI: don't fail if .bash_history is not readable


Modified: grass/trunk/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/goutput.py	2010-10-07 10:57:54 UTC (rev 43819)
+++ grass/trunk/gui/wxpython/gui_modules/goutput.py	2010-10-07 11:11:23 UTC (rev 43820)
@@ -437,13 +437,19 @@
         
         # update history file
         env = grass.gisenv()
-        fileHistory = open(os.path.join(env['GISDBASE'], env['LOCATION_NAME'], env['MAPSET'],
-                                        '.bash_history'), 'a')
+        try:
+            fileHistory = open(os.path.join(env['GISDBASE'], env['LOCATION_NAME'], env['MAPSET'],
+                                            '.bash_history'), 'a')
+        except IOError, e:
+            self.WriteError(str(e))
+            fileHistory = None
+
         cmdString = ' '.join(cmdlist)
-        try:
-            fileHistory.write(cmdString + '\n')
-        finally:
-            fileHistory.close()
+        if fileHistory:
+            try:
+                fileHistory.write(cmdString + '\n')
+            finally:
+                fileHistory.close()
         
         # update history items
         if self.parent.GetName() == 'LayerManager':



More information about the grass-commit mailing list