浏览代码

g.search.modules: print error msg if python-termcolor is not installed

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@67001 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Neteler 9 年之前
父节点
当前提交
9f4a688960
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      scripts/g.search.modules/g.search.modules.py

+ 4 - 1
scripts/g.search.modules/g.search.modules.py

@@ -143,7 +143,10 @@ def colorize(text, attrs=None, pattern=None):
     
 
     if COLORIZE:
-        from termcolor import colored
+        try:
+            from termcolor import colored
+        except ImportError:
+            grass.fatal(_("Cannot colorize, python-termcolor is not installed"))
     else:
         def colored(pattern, attrs):
             return pattern