浏览代码

wxGUI: attempt to fix loading incompatible addons during startup when the error has non-ascii characters

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@64661 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová 10 年之前
父节点
当前提交
8802bc435e
共有 1 个文件被更改,包括 9 次插入3 次删除
  1. 9 3
      gui/wxpython/core/toolboxes.py

+ 9 - 3
gui/wxpython/core/toolboxes.py

@@ -32,7 +32,7 @@ else:
 
 from core.globalvar import WXGUIDIR
 from core.utils import GetSettingsPath, _
-from core.gcmd import GError, RunCommand
+from core.gcmd import GError, RunCommand, EncodeString
 
 import grass.script.task as gtask
 import grass.script.core as gcore
@@ -556,8 +556,14 @@ def _loadMetadata(module):
     """
     try:
         task = gtask.parse_interface(module)
-    except (ScriptError, UnicodeDecodeError) as e:
-        sys.stderr.write("%s: %s\n" % (module, e))
+    except ScriptError as e:
+        e = EncodeString(e.value)
+        # for some reason this works well only if it is separate
+        sys.stderr.write("%s\n" % module)
+        sys.stderr.write("%s\n" % e)
+        return '', ''
+    except UnicodeDecodeError as e:
+        sys.stderr.write("%s\n%s\n" % (module, e))
         return '', ''
 
     return task.get_description(full=True), \