[GRASS-user] problem with python scripting
Paulo van Breugel
p.vanbreugel at gmail.com
Mon Apr 4 23:56:55 PDT 2016
On 05-04-16 08:53, Leonardo Hardtke wrote:
> Dear users,
> I am writing a script and I'm having problems with the flags for mapcalc
> gscript.mapcalc('endmember_rstr.1 = null()', flags="o")
If you are using GRASS 7.+, the overwrite flag should be written in
full, i.e.,
gscript.mapcalc('endmember_rstr.1 = null()', flags="overwrite")
>
> ERROR: output map <endmember_rstr.1> exists. To overwrite, use the
> --overwrite flag
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/usr/lib/grass70/etc/python/grass/script/raster.py", line 103,
> in mapcalc
> quiet=quiet, verbose=verbose, overwrite=overwrite)
> File "/usr/lib/grass70/etc/python/grass/script/core.py", line 516,
> in write_command
> return handle_errors(returncode, returncode, args, kwargs)
> File "/usr/lib/grass70/etc/python/grass/script/core.py", line 312,
> in handle_errors
> returncode=returncode)
> File "/usr/lib/grass70/etc/python/grass/exceptions/__init__.py",
> line 68, in __init__
> msg = _("Module run %s %s ended with error") % (module, code)
> TypeError: 'str' object is not callable
>
> with other modules flags are working as I expect, like....
>
> gscript.run_command("g.region", flags="p")
> projection: 1 (UTM)
> zone: -20
> datum: wgs84
> ellipsoid: wgs84
> north: 5326556.02809
> south: 5228355.32592
> west: 290546.512535
> east: 444008.446334
> nsres: 30.00326984
> ewres: 30.0081998
> rows: 3273
> cols: 5114
> cells: 16738122
>
> Am I missing something?
>
> Thanks!
> --
> Dr. Leonardo A. Hardtke
> Laboratorio de Teledetección y S.I.G.
> Centro Nacional Patagónico (CONICET)
> Bvd. Brown 2825, 9120
> Puerto Madryn, Chubut, Argentina
>
>
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20160405/12945bf8/attachment.html>
More information about the grass-user
mailing list