Hello Markus,<br><br>I have tried to iimplement the example in my way. The code is as follows<br><br>import os<br>import sys<br>import core as grass<br><br>def main():<br> input_map = options['H:/Shared_data/test1.tif']<br>
output_map = options['Test_24']<br> ret = grass.run_command("r.in.gdal", input = input_map, output = output_map)<br> sys.exit(ret)<br><br> <br>if __name__ == "__main__":<br> options, flags = grass.parser()<br>
main()<br><br>But I get the following error, I cant make out where I am going wrong. I have set all the Env variables as suggested in the wiki page. Please help me to implement it.<br><br><br>F:\GRASS-6-SVN\etc\python\grass\script>python test.py<br>
Traceback (most recent call last):<br> File "test.py", line 18, in <module><br> options, flags = grass.parser()<br> File "F:\GRASS-6-SVN\etc\python\grass\script\core.py", line 359, in parser<br>
os.execvp("g.parser.exe", [name] + argv)<br> File "F:\Quantum GIS\python\os.py", line 353, in execvp<br> _execvpe(file, args)<br> File "F:\Quantum GIS\python\os.py", line 389, in _execvpe<br>
func(fullname, *argrest)<br>OSError: [Errno 22] Invalid argument<br><br>With Regards<br>Bishwarup<br><br><br><br><div class="gmail_quote">On Wed, Mar 24, 2010 at 2:24 AM, Markus Neteler <span dir="ltr"><<a href="mailto:neteler@osgeo.org">neteler@osgeo.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">On Mon, Mar 22, 2010 at 1:28 PM, Bishwarup Banerjee<br>
<<a href="mailto:bishwarup.banerjee@gmail.com">bishwarup.banerjee@gmail.com</a>> wrote:<br>
> Hi All,<br>
><br>
> I want to call the grass functionalities from inside my python plugins, in<br>
> QGIS<br>
> For example: the Grass's raster to polygon script, with out going inside the<br>
> grass plugin.<br>
> Can I set the Grass Mapset, and location from inside my python plugin?<br>
> Is this possible?<br>
<br>
</div>I think yes. See also<br>
<a href="http://grass.osgeo.org/wiki/GRASS_and_Python" target="_blank">http://grass.osgeo.org/wiki/GRASS_and_Python</a><br>
<br>
(@all: please extend the Wiki page!)<br>
<div class="im"><br>
> my configurations are:<br>
> QGIS 0.11, GRASS 6.3, python 2.5, Windows<br>
<br>
</div>Note that there are substantial improvements in GRASS 6.4+ for Python.<br>
<font color="#888888"><br>
Markus<br>
</font></blockquote></div><br>