[GRASS-user] How to embed a grass script (for example v.db.addcol) into a Pythonscript on windows?

Glynn Clements glynn at gclements.plus.com
Wed Mar 3 17:41:47 EST 2010

Sonja Jankowfsky wrote:

> I'm using the winGRASS 6.4. standalone version. I guess the problem is 
> that the scripts are in shell language, compared to the .exe files of 
> for example v.build.polylines.

In this case, it's a problem with the arguments to v.db.addcol, as
Martin has pointed out.

> So, does anybody know how to call a shell script with python under 
> windows? Or do I have to include somehow the translated scripts of GRASS7?

The GRASS packages for Windows include a batch file for each shell
script. If you create your own shell scripts, you also need to create
a batch file.

On Windows, grass.run_command() etc invoke the program via cmd.exe, so
they also work with scripts, provided that the script has an extension
and the extension is associated with the correct interpreter.

The shell scripts don't have an extension, hence the need for the
batch files. In 7.0, the shell scripts have been replaced by Python
scripts, which have a .py extension, so the batch files aren't

Glynn Clements <glynn at gclements.plus.com>

More information about the grass-user mailing list