瀏覽代碼

r.out.xyz: fix for windows (pipe problem)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@57905 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová 11 年之前
父節點
當前提交
4b5ad0d33d
共有 1 個文件被更改,包括 11 次插入4 次删除
  1. 11 4
      scripts/r.out.xyz/r.out.xyz.py

+ 11 - 4
scripts/r.out.xyz/r.out.xyz.py

@@ -35,14 +35,21 @@
 import sys
 import sys
 from grass.script import core as grass
 from grass.script import core as grass
 
 
+
 def main():
 def main():
     # if no output filename, output to stdout
     # if no output filename, output to stdout
     output = options['output']
     output = options['output']
-    if not output:
-        output = '-'
+    sep = options['separator']
+
+    parameters = dict(flags="1gn",
+                      input=options['input'])
+    if output:
+        parameters.update(output=output)
+    # windows don't like pipe so we don't include it in the command explicitly
+    if sep != '|':
+        parameters.update(separator=sep)
 
 
-    ret = grass.run_command("r.stats", flags="1gn", input=options['input'],
-                            sep=options['separator'], output=output)
+    ret = grass.run_command("r.stats", **parameters)
     sys.exit(ret)
     sys.exit(ret)
 
 
 if __name__ == "__main__":
 if __name__ == "__main__":