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

Glynn Clements glynn at gclements.plus.com
Thu Jun 30 19:34:33 EDT 2011


katrin eggert wrote:

> I want to integrate in a Python script a call to an external binary (a small
> fucntion that I have done). What can i use to do this?

The standard Python functions for spawning child processes are
subprocess.Popen() and subprocess.call()

	http://docs.python.org/library/subprocess.html

The grass.script module has its own versions of these functions, which
set shell=True on Windows so that scripts work, but that doesn't
matter if you're running a binary executable. It also has several
functions which are intended specifically for running GRASS modules
(anything that uses the GRASS command-line parser).

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


More information about the grass-user mailing list