[GRASS-SVN] r68704 - in grass/trunk/gui/wxpython: . core

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Jun 17 04:14:41 PDT 2016


Author: martinl
Date: 2016-06-17 04:14:41 -0700 (Fri, 17 Jun 2016)
New Revision: 68704

Modified:
   grass/trunk/gui/wxpython/core/utils.py
   grass/trunk/gui/wxpython/gis_set.py
Log:
wxGUI: catch also UnicodeDecodeError when reading current directory as GISDBASE

Modified: grass/trunk/gui/wxpython/core/utils.py
===================================================================
--- grass/trunk/gui/wxpython/core/utils.py	2016-06-17 04:12:15 UTC (rev 68703)
+++ grass/trunk/gui/wxpython/core/utils.py	2016-06-17 11:14:41 UTC (rev 68704)
@@ -614,7 +614,7 @@
                     listOfLocations.append(os.path.basename(location))
             except:
                 pass
-    except UnicodeEncodeError as e:
+    except (UnicodeEncodeError, UnicodeDecodeError) as e:
         raise e
 
     ListSortLower(listOfLocations)

Modified: grass/trunk/gui/wxpython/gis_set.py
===================================================================
--- grass/trunk/gui/wxpython/gis_set.py	2016-06-17 04:12:15 UTC (rev 68703)
+++ grass/trunk/gui/wxpython/gis_set.py	2016-06-17 11:14:41 UTC (rev 68704)
@@ -787,10 +787,11 @@
         """Update list of locations"""
         try:
             self.listOfLocations = GetListOfLocations(dbase)
-        except UnicodeEncodeError:
+        except (UnicodeEncodeError, UnicodeDecodeError) as e:
             GError(parent=self,
-                   message=_("Unable to set GRASS database. "
-                             "Check your locale settings."))
+                   message=_("Unicode error detected. "
+                             "Check your locale settings. Details: {}").format(e),
+                   showTraceback=False)
 
         self.lblocations.Clear()
         self.lblocations.InsertItems(self.listOfLocations, 0)



More information about the grass-commit mailing list