On 07/11/2018 02:20 AM, Gabriel Cotlier wrote:
Dear grass users,

I'm using grass 7.4.1 trying to export  all raster layers in the current mapset out of grass to a folder as GeoTiff files though a for loop from the python shell  as follows and I'm getting the error in red...
What could be the problem?
Thanks a lot in advance.
Regards,
Gabriel

>>>import grass.script as gscript
>>>rastlist=grass.read_command("g.list",type="rast")
>>>rastlist
F121996
F121997
F141999
F142000

Try:
rastlist=grass.read_command("g.list",type="rast").split()


>>>os.chdir('C:\\Users\\Gabriel\\Desktop\\out')
None
>>>for raster in rastlist:
...         gscript.run_command('r.out.gdal', input=raster,
...                                             output=raster + '.tiff', format='GTiff')
                       
Traceback (most recent call last):
  File "<input>", line 3, in <module>
  File "C:\OSGEO4~1\apps\grass\grass-7.4.1\etc\python\grass\script\core.py", line 421, in run_command
    return handle_errors(returncode, returncode, args, kwargs)
  File "C:\OSGEO4~1\apps\grass\grass-7.4.1\etc\python\grass\script\core.py", line 332, in handle_errors
    returncode=returncode)
CalledModuleError: Module run None ['r.out.gdal', 'input=F', 'output=F.tiff', 'format=GTiff'] ended with error
Process ended with non-zero return code 1. See errors in the (error) output.



_______________________________________________
grass-user mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/grass-user

-- 
Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972-523-665918

_______________________________________________
grass-user mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to