Please try gscript.mapcalc(expr... , overwrite=True) Am 05.04.2016 09:02 schrieb "Leonardo Hardtke" <leohard...@gmail.com>:
> Hi Paulo and thanks for the answer... but It gives me a very similar error > if I write the full flag.... (The only difference is TypeError... str if I > use 'o' and int if I use 'overwrite'.... ) > > 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: 'int' object is not callable > > Thanks for your help! > > 2016-04-05 16:56 GMT+10:00 Paulo van Breugel <p.vanbreu...@gmail.com>: > >> >> >> 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 >> listgrass-user@lists.osgeo.orghttp://lists.osgeo.org/mailman/listinfo/grass-user >> >> >> > > > -- > 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@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/grass-user >
_______________________________________________ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user