浏览代码

winGRASS: fig debug() to handle '&' on Windows, check debug_level

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@59352 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 11 年之前
父节点
当前提交
887e6b090e
共有 1 个文件被更改,包括 5 次插入2 次删除
  1. 5 2
      lib/python/script/core.py

+ 5 - 2
lib/python/script/core.py

@@ -510,8 +510,11 @@ def debug(msg, debug=1):
     @param msg debugging message to be displayed
     @param debug debug level (0-5)
     """
-    run_command("g.message", flags='d', message=msg, debug=debug)
-
+    if debug_level() >= debug:
+        if sys.platform == "win32":
+            msg = msg.replace('&', '^&')
+            
+        run_command("g.message", flags='d', message=msg, debug=debug)
 
 def verbose(msg):
     """!Display a verbose message using `g.message -v`