[GRASS-SVN] r68706 - in grass/branches/releasebranch_7_0/gui/wxpython: . core

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Jun 17 04:24:28 PDT 2016


Author: martinl
Date: 2016-06-17 04:24:28 -0700 (Fri, 17 Jun 2016)
New Revision: 68706

Modified:
   grass/branches/releasebranch_7_0/gui/wxpython/core/utils.py
   grass/branches/releasebranch_7_0/gui/wxpython/gis_set.py
Log:
wxGUI: catch also UnicodeDecodeError when reading current directory as GISDBASE (merge r68704 from trunk)

Modified: grass/branches/releasebranch_7_0/gui/wxpython/core/utils.py
===================================================================
--- grass/branches/releasebranch_7_0/gui/wxpython/core/utils.py	2016-06-17 11:17:14 UTC (rev 68705)
+++ grass/branches/releasebranch_7_0/gui/wxpython/core/utils.py	2016-06-17 11:24:28 UTC (rev 68706)
@@ -633,7 +633,7 @@
                     listOfLocations.append(os.path.basename(location))
             except:
                 pass
-    except UnicodeEncodeError as e:
+    except (UnicodeEncodeError, UnicodeDecodeError) as e:
         raise e
     
     ListSortLower(listOfLocations)

Modified: grass/branches/releasebranch_7_0/gui/wxpython/gis_set.py
===================================================================
--- grass/branches/releasebranch_7_0/gui/wxpython/gis_set.py	2016-06-17 11:17:14 UTC (rev 68705)
+++ grass/branches/releasebranch_7_0/gui/wxpython/gis_set.py	2016-06-17 11:24:28 UTC (rev 68706)
@@ -729,11 +729,12 @@
         """Update list of locations"""
         try:
             self.listOfLocations = GetListOfLocations(dbase)
-        except UnicodeEncodeError:
-            GError(parent = self,
-                   message = _("Unable to set GRASS database. "
-                               "Check your locale settings."))
-                
+        except (UnicodeEncodeError, UnicodeDecodeError) as e:
+            GError(parent=self,
+                   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