<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 25, 2015 at 5:40 PM, Andrea Peri <span dir="ltr"><<a href="mailto:aperi2007@gmail.com" target="_blank">aperi2007@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I report the last tests:<br>
<span><br>
2015-06-25 15:15 GMT+02:00 Vaclav Petras <<a href="mailto:wenzeslaus@gmail.com" target="_blank">wenzeslaus@gmail.com</a>>:<br>
><br>
><br>
> /usr/bin/env python -c "import sys; print(sys.path)"<br>
><br>
<br>
</span>~$ /usr/bin/env python -c "import sys; print(sys.path)"<br>
['', '/usr/local/lib/python2.7/dist-packages/GDAL-2.0.0-py2.7-linux-x86_64.egg',<br>
<span>'/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2',<br>
'/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old',<br>
'/usr/lib/python2.7/lib-dynload',<br>
'/usr/local/lib/python2.7/dist-packages',<br>
'/usr/lib/python2.7/dist-packages',<br>
'/usr/lib/python2.7/dist-packages/PIL',<br>
'/usr/lib/pymodules/python2.7',<br>
'/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode']<br></span></blockquote><div><br></div><div>Well, nothing unusual if this is outside of GRASS.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span>
<br>
</span>I use the panshapen tools outside from grass.<br></blockquote><div><br><div><br></div>Well, this is different case then! So, Moritz was right. Did I missed this information somewhere?<br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
I set all the Grass env vars  and call the grass tools.<br>
Is this a wrong use ?<br></blockquote><br></div><div class="gmail_quote">Not wrong, just hard to do. You have to set the variables. There is no way around it and you have to set them right. There is a function and documentation to help you with that in Python:<br><br><a href="http://grass.osgeo.org/grass71/manuals/libpython/script.html#module-script.setup" target="_blank">http://grass.osgeo.org/grass71/manuals/libpython/script.html#module-script.setup</a><br></div><div class="gmail_quote"><br></div><div class="gmail_quote">If you would like to do Bash or some other language, then you are on your own but the list of variables is the same. Multiple suggestions how to do that are here:<br><br><a href="http://grasswiki.osgeo.org/wiki/Working_with_GRASS_without_starting_it_explicitly" target="_blank">http://grasswiki.osgeo.org/wiki/Working_with_GRASS_without_starting_it_explicitly</a><br></div><div class="gmail_quote"><br></div><div class="gmail_quote">GRASS modules run only in the proper environment which is best ensured by actually running GRASS. This is probably clear to you now but it never harms to repeat his because the question resurfaces all over again.<br></div><div class="gmail_quote"><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
I choose this solution because need to write a batch to process<br>
periodically from a cron .<br></blockquote><div><br></div><div>You have more options available than setting it yourself.<br><br>In 6.4 and 7.0 there is GRASS_BATCH_JOB variable which sets a script to be executed inside GRASS, then you run `grass`. Either the variable will work for you in the crontab or you have to write one wrapper script to set it to the actual script and and call `grass`.<br><br></div><div>In the trunk (upcoming 7.1), there is --exec parameter which I believe should cover significant amount of cases (not all unfortunately) where people were setting the variables or used cumbersome GRASS_BATCH_JOB. You can run `grass` and in command line specify your script or GRASS module to be executed inside GRASS session. Here are the resources:<br><br><a href="http://grass.osgeo.org/grass71/manuals/grass7.html#exec-interface-example">http://grass.osgeo.org/grass71/manuals/grass7.html#exec-interface-example</a><br><a href="https://lists.osgeo.org/pipermail/grass-user/2015-June/072511.html">https://lists.osgeo.org/pipermail/grass-user/2015-June/072511.html</a><br><a href="https://trac.osgeo.org/grass/ticket/2579">https://trac.osgeo.org/grass/ticket/2579</a><br><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<span><font color="#888888"><br>
A.<br>
</font></span><div><div><br>
--<br>
-----------------<br>
Andrea Peri<br>
. . . . . . . . .<br>
qwerty àèìòù<br>
-----------------<br>
</div></div></blockquote></div><br></div></div>