<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>Rodrigo, </div><div><br></div><div>Nem parei pra ler o código, de modo que a resposta, se ajudar, deve ser no sentido de vc entender melhor como organizar seus arquivos.</div><div><br></div><div>Mas sem entender os conceitos de GISDBASE, LOCATION e MAPSET vc praticamente nao trabalha no grass. Sinto dizer mas isso é menos python e mais grass…</div><div><br></div><div><a href="http://grasswiki.osgeo.org/wiki/Working_with_GRASS_without_starting_it_explicitly">http://grasswiki.osgeo.org/wiki/Working_with_GRASS_without_starting_it_explicitly</a></div><div><br></div><div>pra dar uma facilitada na vida, já pensou em rodar o grass do qgis?!?</div><div><a href="http://qgis.spatialthoughts.com/2012/01/setting-up-working-grass-environment-in.html">http://qgis.spatialthoughts.com/2012/01/setting-up-working-grass-environment-in.html</a></div><div><br></div><div>[   ]s</div><div><br></div><div>e boa sorte!</div><div><br></div><br><div><div>On Aug 19, 2014, at 3:11, Rodrigo Koblitz <<a href="mailto:rodrigokoblitz@yahoo.com.br">rodrigokoblitz@yahoo.com.br</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><div style="background-color: rgb(255, 255, 255); font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 10pt;"><div style="" class=""><span style="" class="">Olá Daniel,</span></div><div class="" style="font-size: 13.3333px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;"><span style="" class="">Obrigado pela atenção.</span></div><div class="" style="font-size: 13.3333px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;"><br style="" class=""><span style="" class=""></span></div><div class="" style="font-size: 13.3333px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;"><span style="" class="">Então, acho que estou tendo algum problema com o acesso ao grass. O tifref e tifout são strings de caminhos para os arquivos.</span></div><div class="" style="font-size: 13.3333px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;"><span style="" class="">Coloquei a função aqui:</span></div><div class="" style="font-size: 13.3333px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;"><span style="" class=""><a href="http://pastebin.com/Dnz9g6P1">http://pastebin.com/Dnz9g6P1</a></span></div><div class="" style="font-size: 13.3333px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;"><br style="" class=""><span style="" class=""></span></div><div class="" style="font-size: 13.3333px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;"><span style="" class="">Acho que o </span>'gsetup.<span style="" class="">init</span><span style="" class="">(</span>gisbase<span style="" class="">,</span>gisdb<span style="" class="">,</span> location<span style="" class="">,</span> mapset<span style="" class="">)' que estou tentanto acessar está com algum problema.</span></div><div class="" style="font-size: 13.3333px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;"><span style="" class=""><br></span></div><div class="" style="font-size: 13.3333px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;"><span style="" class="">Temporariamente estou resolvendo entrando direto no ambiente grass (grass -text) e a partir daí vou para o shell do python. Então fico dando os.system ('commando do grass') e vou caminhando.<br></span></div><div class="" style="font-size: 13.3333px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;"><span style="" class="">Esse erro é bem incomum. O google mostrou muito poucas coisas...</span></div><div class="" style="font-size: 13.3333px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;"><span style="" class="">mais uma vez obrigado,</span></div><div class="" style="font-size: 13.3333px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;"><span style="" class="">abs,</span></div><div class="" style="font-size: 13.3333px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;"><span style="" class="">Koblitz<br></span></div><div class="" style="font-size: 13.3333px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;"><span style="" class=""><br></span></div> <div class="qtdSeparateBR"><br><br></div><div style="display: block;" class="yahoo_quoted"> <div class="" style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 10pt;"> <div class="" style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 12pt;"> <div style="" class="" dir="ltr"> <font style="" class="" face="Arial" size="2"> Em Segunda-feira, 18 de Agosto de 2014 10:28, Daniel Araujo Miranda <<a href="mailto:miranda.dam@dpf.gov.br">miranda.dam@dpf.gov.br</a>> escreveu:<br style="" class=""> </font> </div>  <br style="" class=""><br style="" class=""> <div style="" class="">Olá Rodrigo,<br style="" class="" clear="none">   Não mexo com o Grass, mas é possível que uma das suas variáveis <br style="" class="" clear="none">esteja em branco. Dê um print no tifref e no tifout.<br style="" class="" clear="none"><br style="" class="" clear="none">   No código fonte, o único lugar em que eu achei essa mensagem de erro <br style="" class="" clear="none">foi no get_window.c. Se a mensagem vier dessa função mesmo, isso quer <br style="" class="" clear="none">dizer que o nome do "element" estava vazio (vide primeiro %s na mensagem <br style="" class="" clear="none">de erro). Estou supondo que esse parâmetro deveria ter o mesmo valor da <br style="" class="" clear="none">variável
 "tifref".<br style="" class="" clear="none"><br style="" class="" clear="none"><br style="" class="" clear="none">Segue o trecho:<br style="" class="" clear="none"><br style="" class="" clear="none"><br style="" class="" clear="none">get_window.c<br style="" class="" clear="none">  ...<br style="" class="" clear="none">   107 void G__get_window(struct Cell_head *window,<br style="" class="" clear="none">   108                    const char *element, const char *name, const <br style="" class="" clear="none">char *mapset)<br style="" class="" clear="none">   109 {<br style="" class="" clear="none">   110     FILE *fp;<br style="" class="" clear="none">   111<br style="" class="" clear="none">   112     G_zero(window, sizeof(struct Cell_head));<br style="" class="" clear="none">   113<br style="" class="" clear="none">   114     /*
 Read from file */<br style="" class="" clear="none">   115     fp = G_fopen_old(element, name, mapset);<br style="" class="" clear="none">   116     if (!fp)<br style="" class="" clear="none">   117         G_fatal_error(_("Unable to open element file <%s> for <br style="" class="" clear="none"><%s@%s>"),<br style="" class="" clear="none">   118                         element, name, mapset);<br style="" class="" clear="none">   119<br style="" class="" clear="none">   120     G__read_Cell_head(fp, window, 0);<br style="" class="" clear="none">   121     fclose(fp);<br style="" class="" clear="none">   122 }<br style="" class="" clear="none">...<br style="" class="" clear="none"><br style="" class="" clear="none">Boa sorte.<br style="" class="" clear="none"><br style="" class="" clear="none">Abraço,<br style="" class="" clear="none">Miranda<br style="" class="" clear="none"><div style="" class="" id="yqtfd13081"><br style="" class="" clear="none">Em 15/08/2014 19:50, Rodrigo Koblitz escreveu:<br style="" class="" clear="none">> Buenos,<br style="" class="" clear="none">> estou tentando rodar um script do grass no shell do python mas não estou<br style="" class="" clear="none">> conseguindo importar o .tif para o ambiente grass.<br style="" class="" clear="none">><br style="" class="" clear="none">> abrindo ok o ambiente no shell do python, mas dequalquer forma que eu tente:<br style="" class="" clear="none">> os.system('r.in.gdal input=%s output=%s --overwrite -k -e'%(tifref,tifout))<br style="" class="" clear="none">> g.run_command('r.in.gdal', flags='e', input='%s'%tifref, output='%s'%tifout)<br style="" class="" clear="none">> script.parse_command('r.in.gdal', flags='e', input='%s'%tifref,<br style="" class="" clear="none">> output='%s'%tifout)<br style="" class="" clear="none">><br style="" class="" clear="none">> o resultado é o mesmo:<br style="" class="" clear="none">> ERROR: Unable to open element file <> for <<a style="" class="" shape="rect" ymailto="mailto:DEFAULT_WIND@PERMANENT" href="mailto:DEFAULT_WIND@PERMANENT">DEFAULT_WIND@PERMANENT</a>><br style="" class="" clear="none">><br style="" class="" clear="none">> alguém já passou por isso?<br style="" class="" clear="none">> idéias?<br style="" class="" clear="none">><br style="" class="" clear="none">> abs,<br style="" class="" clear="none">> Koblitz</div><br style="" class="" clear="none">><br style="" class="" clear="none">><br style="" class="" clear="none">> _______________________________________________<br style="" class="" clear="none">> Brasil mailing list<br style="" class="" clear="none">> <a style="" class="" shape="rect" ymailto="mailto:Brasil@lists.osgeo.org" href="mailto:Brasil@lists.osgeo.org">Brasil@lists.osgeo.org</a><br style="" class="" clear="none">> <a style="" class="" shape="rect" href="http://lists.osgeo.org/mailman/listinfo/brasil" target="_blank">http://lists.osgeo.org/mailman/listinfo/brasil</a><div style="" class="" id="yqtfd24399"><br style="" class="" clear="none">><br style="" class="" clear="none"></div><br style="" class=""><br style="" class=""></div>  </div> </div>  </div> </div></div>_______________________________________________<br>Brasil mailing list<br><a href="mailto:Brasil@lists.osgeo.org">Brasil@lists.osgeo.org</a><br>http://lists.osgeo.org/mailman/listinfo/brasil</blockquote></div><br></body></html>