Dear All,<br><br>Thank you very much for all your inputs and you guys have done a wonderful work.<br>I am able to solve my problem.<br>Three Cheers for Grass and Open Source Softwares.<br>Thanks you all once again.<br><br>
With Regards,<br>Bishwarup<br><br><div class="gmail_quote">On Thu, Mar 25, 2010 at 7:50 AM, Glynn Clements <span dir="ltr"><<a href="mailto:glynn@gclements.plus.com">glynn@gclements.plus.com</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"><br>
Bishwarup Banerjee wrote:<br>
<br>
> I have tried to iimplement the example in my way. The code is as follows<br>
<br>
</div>> import core as grass<br>
<br>
This should be:<br>
<br>
import grass.script as grass<br>
or:<br>
import grass.script.core as grass<br>
<div class="im"><br>
> def main():<br>
> input_map = options['H:/Shared_data/test1.tif']<br>
> output_map = options['Test_24']<br>
<br>
</div>This is bogus. The keys in the "options" dictionary are the names of<br>
the options defined in the g.parser comments (assuming that you have<br>
them; if you don't, grass.parser() won't work).<br>
<div class="im"><br>
> But I get the following error, I cant make out where I am going wrong. I<br>
> have set all the Env variables as suggested in the wiki page. Please help me<br>
> 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>
</div>I have no idea what's causing this.<br>
<br>
I suggest modifying the parser() function to print the arguments which<br>
are being passed to os.execvp():<br>
<div><div></div><div class="h5"><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>
<br>
</div></div><font color="#888888">--<br>
Glynn Clements <<a href="mailto:glynn@gclements.plus.com">glynn@gclements.plus.com</a>><br>
</font></blockquote></div><br>