Browse Source

wxGUI: catch also UnicodeDecodeError when reading current directory as GISDBASE

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@68704 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 9 years ago
parent
commit
3147062cbd
2 changed files with 5 additions and 4 deletions
  1. 1 1
      gui/wxpython/core/utils.py
  2. 4 3
      gui/wxpython/gis_set.py

+ 1 - 1
gui/wxpython/core/utils.py

@@ -614,7 +614,7 @@ def GetListOfLocations(dbase):
                     listOfLocations.append(os.path.basename(location))
             except:
                 pass
-    except UnicodeEncodeError as e:
+    except (UnicodeEncodeError, UnicodeDecodeError) as e:
         raise e
 
     ListSortLower(listOfLocations)

+ 4 - 3
gui/wxpython/gis_set.py

@@ -787,10 +787,11 @@ class GRASSStartup(wx.Frame):
         """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)