[GRASS-user] Python scripts- How to call external bin

Glynn Clements glynn at gclements.plus.com
Mon Jul 4 16:38:26 EDT 2011


katrin eggert wrote:

> Just one question: I reading
> http://grass.osgeo.org/programming6/pythonlib.html the "*GRASS-oriented
> interface to subprocess module" and I'm wondering wich one of this functions
> shall i use to run an external bin in Windows? run_command?*

Does the external program use the GRASS parser? If it doesn't, you
shouldn't use any of those functions; just use subprocess.Popen().

If it uses the parser, then the correct command to use depends upon
how you wish to interact with the child process. Read each of their
descriptions to determine which is appropriate.

All of them (except for exec_command) are simple wrappers around
start_command, which itself just uses make_command to construct a
suitable argument list to pass to Popen().

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-user mailing list