[GRASS-SVN] r63997 - grass/trunk/gui/wxpython/lmgr

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jan 8 09:02:46 PST 2015


Author: annakrat
Date: 2015-01-08 09:02:46 -0800 (Thu, 08 Jan 2015)
New Revision: 63997

Modified:
   grass/trunk/gui/wxpython/lmgr/frame.py
Log:
wxGUI: attempt to fix launching script on Windows #2532

Modified: grass/trunk/gui/wxpython/lmgr/frame.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/frame.py	2015-01-08 13:57:08 UTC (rev 63996)
+++ grass/trunk/gui/wxpython/lmgr/frame.py	2015-01-08 17:02:46 UTC (rev 63997)
@@ -43,7 +43,7 @@
 
 from grass.script          import core as grass
 
-from core.gcmd             import RunCommand, GError, GMessage, GException
+from core.gcmd             import RunCommand, GError, GMessage, EncodeString
 from core.settings         import UserSettings, GetDisplayVectSettings
 from core.utils            import SetAddOnPath, GetLayerNameFromCmd, command2ltype, _
 from gui_core.preferences  import MapsetAccess, PreferencesDialog
@@ -851,6 +851,14 @@
         
         if not filename:
             return False
+        try:
+            filename_encoded = EncodeString(filename)
+        except UnicodeEncodeError:
+            GError(parent=self,
+                   message = _("Due to the limitations of your operating system, "
+                               "the script path cannot contain non-ascii characters. "
+                               "Please rename the script or move it to a different location."))
+            return
         
         if not os.path.exists(filename):
             GError(parent = self,
@@ -882,7 +890,7 @@
         addonPath = os.getenv('GRASS_ADDON_PATH', [])
         if addonPath:
             addonPath = addonPath.split(os.pathsep)
-        dirName = os.path.dirname(filename)
+        dirName = os.path.dirname(filename_encoded)
         if dirName not in addonPath:
             addonPath.append(dirName)
             dlg = wx.MessageDialog(self,



More information about the grass-commit mailing list