Kaynağa Gözat

wxGUI: catch also UnicodeDecodeError when reading current directory as GISDBASE (merge https://trac.osgeo.org/grass/changeset/68704 from trunk)

git-svn-id: https://svn.osgeo.org/grass/grass/branches/releasebranch_7_0@68706 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 9 yıl önce
ebeveyn
işleme
de4593bdcc
2 değiştirilmiş dosya ile 7 ekleme ve 6 silme
  1. 1 1
      gui/wxpython/core/utils.py
  2. 6 5
      gui/wxpython/gis_set.py

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

@@ -633,7 +633,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)

+ 6 - 5
gui/wxpython/gis_set.py

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