#2314: output r.out.xyz -------------------------------------------------+-------------------------- Reporter: pvanbosgeo | Owner: grass-dev@… Type: defect | Status: new Priority: normal | Milestone: 7.0.0 Component: Default | Version: svn-trunk Keywords: separator, pipe, r.out.xyz, r.stats | Platform: MSWindows 7 Cpu: All | -------------------------------------------------+--------------------------
Comment(by glynn): Replying to [comment:30 hcho]: > Setting shell=False alone doesn't fix this problem. We still need {{{^^^|}}} (4 less carets). Why? The caret-escape mechanism is specific to cmd.exe, which is no longer used. The escaping needed to ensure that the command's "argv" array has the correct values is performed by the subprocess module (and doesn't involve carets). > Also, we lose useful cmd.exe commands (e.g., cd, dir, type, ...). A Python script shouldn't be executing such commands, but should be using Python's own functionality. In particular, executing a "cd" command in a child process is pointless, as its effect is limited to the child process itself. In any case r60679 removes all of the Popen() hackery from grass.script.core.py. grass.script.Popen() is now effectively an alias for subprocess.Popen(). Execution of (e.g.) Python scripts from within Python scripts will require either specifying the interpreter explicitly, or the use of a batch file, or specifying shell=True (and providing any necessary quoting). Ultimately, it's impossible to quote correctly when shell=True, as it uses %COMSPEC% (if it's set) as the interpreter, and there's no guarantee that it will use exactly the same quoting rules as cmd.exe. Technically, similar issues apply when shell=False, as it's up to the executable to parse the command line into arguments. Fortunately, the parsing rules are now documented and widely followed. -- Ticket URL: <http://trac.osgeo.org/grass/ticket/2314#comment:31> GRASS GIS <http://grass.osgeo.org> _______________________________________________ grass-dev mailing list grass-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-dev