[GRASS-dev] Popen and r.mapcalc, pygrass' implications
Glynn Clements
glynn at gclements.plus.com
Thu Aug 14 04:08:49 PDT 2014
Pietro wrote:
> Pygrass is not working properly with r.mapcalc, the problem is how the
> Popen class is used internally, so playing with Popen class:
>
> {{{
> In [1]: import subprocess as sub
>
> In [2]: cmd_list = ['r.mapcalc', 'expression="elev100=elevation*100"', '--o']
This is wrong. The double-quote characters shouldn't be there.
> In [5]: sub.Popen(cmd_shell, shell=True)
Passing a string instead of a list is rarely a good idea. Apart from
anything else, you have to construct the string differently depending
upon whether you're using Unix or Windows (/bin/sh and cmd.exe have
significant differences in their command syntax).
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev
mailing list