<div dir="ltr">solved with correcting spelling mistake at file extension, now the for loop worked for me as: <div><br></div><div><div><img src="cid:ii_jjhp78el0_1648b77bd7eca468" width="783" height="41" style="margin-right: 0px;"><br></div><br></div><div>Gabriel </div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 11, 2018 at 6:39 PM, Gabriel Cotlier <span dir="ltr"><<a href="mailto:gabiklm01@gmail.com" target="_blank">gabiklm01@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Dear Nikos and Micha,<div><br></div><div>I tried both and worked ways for constructing the list and worked well:</div><div><br></div><div><div><img src="cid:ii_jjhnaem91_1648b46bd542ba17" width="652" height="116" style="margin-right:0px"><br></div><br><div>and also:</div></div><div><br></div><div><div><img src="cid:ii_jjhnb8zm2_1648b4761966cd2b" width="695" height="96" style="margin-right:0px"><br></div><br></div><div>but still have an error problem with the loop<img src="cid:ii_jjhnbz2j3_1648b47db0faea46" width="901" height="219" style="margin-right:0px"></div><div><br></div><div>why could be this happening?</div><div>Thanks a lot.</div><span class="HOEnZb"><font color="#888888"><div>Gabriel</div></font></span></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Wed, Jul 11, 2018 at 5:00 AM, Nikos Alexandris <span dir="ltr"><<a href="mailto:nik@nikosalexandris.net" target="_blank">nik@nikosalexandris.net</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">* Nikos Alexandris <<a href="mailto:nik@nikosalexandris.net" target="_blank">nik@nikosalexandris.net</a>> [2018-07-11 09:14:47 +0200]:<span><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Gabriel Cotlier wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
I'm using grass 7.4.1 trying to export all raster layers in the current<br>
mapset out of grass to a folder as GeoTiff files though a for loop from<br>
the python shell as follows and I'm getting the error in red...<br>
What could be the problem?<br>
Thanks a lot in advance.<br>
Regards,<br>
Gabriel<br>
>>>import grass.script as gscript<br>
>>>rastlist=grass.read_comman<wbr>d("g.list",type="rast")<br>
>>>rastlist<br>
F121996<br>
F121997<br>
F141999<br>
F142000<br>
</blockquote>
<br>
Micha Silver:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Try:<br>
rastlist=grass.read_command("<wbr>g.list",type="rast").split()<br>
</blockquote>
<br>
[..]<br>
</blockquote>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
For me it works like:<br>
<br>
rasters=grass.read_command('g.<wbr>list', type='raster', separator='comma').split(',')<br>
</blockquote>
<br></span>
For splitting on newlines, there is splitlines(), i.e.<br>
<br>
```<br>
rasters = grass.read_command('g.list', type='raster').splitlines()<br>
for raster in rasters:<br>
print "Raster:", raster<br>
raster += '.tif'<br>
print "Raster with extension:", raster<br>
```<br>
<br>
See <a href="https://docs.python.org/2/library/stdtypes.html#str.splitlines" rel="noreferrer" target="_blank">https://docs.python.org/2/libr<wbr>ary/stdtypes.html#str.splitlin<wbr>es</a><span class="m_520450960123720339HOEnZb"><font color="#888888"><br>
<br>
Nikos<br>
</font></span><br></div></div><span class="">______________________________<wbr>_________________<br>
grass-user mailing list<br>
<a href="mailto:grass-user@lists.osgeo.org" target="_blank">grass-user@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/grass-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailma<wbr>n/listinfo/grass-user</a><br></span></blockquote></div><br></div>
</blockquote></div><br></div>