Hello everyone,<div><br></div><div><br></div><div>I would like to run some scripts using python. I am not a computer scientist/engineer, just a python newbie, but I find that's a really interesting matter. </div><div>Thus, I followed the instructions here: <a href="http://grass.osgeo.org/wiki/Using_Eclipse_to_develop_GRASS_Python_programs" target="_blank">http://grass.osgeo.org/wiki/Using_Eclipse_to_develop_GRASS_Python_programs</a></div>
<div>and doing so i was able to run from Eclipse the following simple script under windows (WinGRASS 6.4RC2):</div><div><br></div><div><br></div><div>----------------------------------------------------------------------------------------------------------------------------------------------</div>
<div>----------------------------------------------------------------------------------------------------------------------------------------------</div><div><div>#!/usr/bin/env python</div><div>#</div><div>############################################################################</div>
<div>#</div><div># MODULE: model</div><div>#</div><div># AUTHOR(S):<span style="white-space:pre-wrap">        </span>ismael</div><div># </div><div># PURPOSE: Script generated by wxGUI Graphical Modeler.</div>
<div>#</div><div># DATE: Mon Dec 19 18:49:29 2011</div><div>#</div><div>#############################################################################</div><div><br></div><div>import sys</div><div>import os</div><div>
import atexit</div><div><br></div><div>import grass.script as grass</div><div><br></div><div>def cleanup():</div><div> pass</div><div><br></div><div>def main():</div><div> grass.run_command("v.extract --overwrite",</div>
<div> input = "parcelas@Modelo1a",</div><div> output = "parcelasLucrativas",</div><div> where = "Lucr=1")</div><div> grass.run_command("v.overlay --overwrite",</div>
<div> ainput = "fincas@Modelo1a",</div><div> binput = "parcelasLucrativas",</div><div> output = "Xik",</div><div> operator = "and")</div>
<div><br></div><div> return 0</div><div><br></div><div>if __name__ == "__main__":</div><div> options, flags = grass.parser()</div><div> atexit.register(cleanup)</div><div> sys.exit(main())</div></div>
<div><div>----------------------------------------------------------------------------------------------------------------------------------------------</div><div>----------------------------------------------------------------------------------------------------------------------------------------------</div>
</div><div><br></div><div><br></div><div>However, when I try to run it in linux (both Ubuntu 11.10 and Linux Mint 12 installations using the ppa repository) i always get error messages like the following:</div><div><br></div>
<div><div>----------------------------------------------------------------------------------------------------------------------------------------------</div><div><br></div></div><div><div>Traceback (most recent call last):</div>
<div> File "/home/rosie/Dropbox/REPARCELIA-COMUN/GIS/script/GRASS/Modelo1a/modelo1a.py", line 40, in <module></div><div> sys.exit(main())</div><div> File "/home/rosie/Dropbox/REPARCELIA-COMUN/GIS/script/GRASS/Modelo1a/modelo1a.py", line 28, in main</div>
<div> where = "Lucr=1")</div><div> File "/usr/lib/grass64/etc/python/grass/script/core.py", line 176, in run_command</div><div> ps = start_command(*args, **kwargs)</div><div> File "/usr/lib/grass64/etc/python/grass/script/core.py", line 164, in start_command</div>
<div> return Popen(args, **popts)</div><div> File "/usr/lib/grass64/etc/python/grass/script/core.py", line 55, in __init__</div><div> startupinfo, creationflags)</div><div> File "/usr/lib/python2.6/subprocess.py", line 623, in __init__</div>
<div> errread, errwrite)</div><div> File "/usr/lib/python2.6/subprocess.py", line 1141, in _execute_child</div><div> raise child_exception</div><div>OSError: [Errno 2] No such file or directory</div></div>
<div><br></div><div><div><br></div><div>----------------------------------------------------------------------------------------------------------------------------------------------</div></div><div><br></div><div>Since my knowledge is still very limited, I've spent three days turnning around it without success. </div>
<div><br></div><div>Could someone give me some hint on where to start to find a solution for this, please? </div><div>Also: when I run it, how/where could I get more information on the processes running further than those console messages? (sorry, i guess that's more a Eclipse/Python question than a GRASS one) </div>
<div>Thank you very much in advance. </div><div><br></div><div>Regards,</div><div><br></div><div>Ismael G.</div><div><br></div><div><br></div>