<html style="direction: ltr;">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">body p { margin-bottom: 0cm; margin-top: 0pt; } </style>
</head>
<body bidimailui-charset-is-forced="true" style="direction: ltr;"
text="#000000" bgcolor="#FFFFFF">
Thanks for reporting<br>
I didn't realize that exporting could fail due to a file extension.
<br>
<br>
<div class="moz-cite-prefix">On 07/12/2018 01:31 AM, Gabriel Cotlier
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAAKwTDFgSrERS3hNnGXzABgqYk3twqcx95PO8G8M90U2a2g2nQ@mail.gmail.com">
<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:part1.82CF3755.00BC9B42@gmail.com"
style="margin-right: 0px;" class="" height="41"
width="783"><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"
moz-do-not-send="true">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:part3.7F45E0F8.C6AF77E6@gmail.com"
style="margin-right:0px" class="" height="116"
width="652"><br>
</div>
<br>
<div>and also:</div>
</div>
<div><br>
</div>
<div>
<div><img src="cid:part4.222534CF.3EBFAC75@gmail.com"
style="margin-right:0px" class="" height="96"
width="695"><br>
</div>
<br>
</div>
<div>but still have an error problem with the loop<img
src="cid:part5.78FEBE52.7F3B9764@gmail.com"
style="margin-right:0px" class="" height="219"
width="901"></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" moz-do-not-send="true">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" moz-do-not-send="true">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"
moz-do-not-send="true">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" moz-do-not-send="true">grass-user@lists.osgeo.org</a><br>
<a
href="https://lists.osgeo.org/mailman/listinfo/grass-user"
rel="noreferrer" target="_blank"
moz-do-not-send="true">https://lists.osgeo.org/mailma<wbr>n/listinfo/grass-user</a><br>
</span></blockquote>
</div>
<br>
</div>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972-523-665918</pre>
</body>
</html>